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

#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

template<class T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<class T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
///////////////////////////////////////////////
/*（๑•﹏•๑｀) */

const int p = 1000000007;
const int NMAX = 310000;
ll fac[NMAX],finv[NMAX],inv[NMAX];
void combinit(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;

	FORq(i,2,NMAX-1){
		fac[i] = fac[i-1] * i % p;
		inv[i] = p - inv[p%i] * (p / i) % p;
		finv[i] = finv[i-1] * inv[i] % p;
	}
}
long long comb(ll n,int r){
	if (n<r) return 0;
	if (n < 0 || r < 0) return 0;
	return fac[n] * (finv[r] * finv[n-r] % p) % p;
}

int main(){
    ll N,M,K;
    cin >> N >> M >> K;
    combinit();

    ll ans = 0;
    ll ansA = 0;
    for(ll d = 1;d <= N-1; d++){
		ansA =  ansA + d*(N-d);
    }
    ansA = (ansA * ((M * M) % p) % p);
    ans = (ans + ansA) % p;
    ansA = 0;

    swap(N,M);

	for(ll d = 1;d <= N-1; d++){
		ansA =  ansA + d*(N-d);
	}
	ansA = (ansA * ((M * M) % p) % p);
	ans = (ans + ansA) % p;
	ansA = 0;

	ans *= comb(N*M-2,K-2);
	ans = ans % p;
    if (ans < 0) ans += p;
    cout << ans << "\n";
}

Measured memory_bytes: 7552
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);




		while(scanner.hasNext()){

			Human human=new Human();

			for(int i =0;i<12;i++){

				String st=scanner.next();

				for(int k =0;k<12;k++){

					if(st.charAt(k)=='1'){

						human.map[k][i]=true;
					}


				}
			}


			int count=0;

			for(int i=0;i<12;i++){
				


				for (int k=0;k<12;k++){
					if(human.map[k][i]){
						human.Advent(k,i);//この処理で到達した島はすべて海になるため検索に引っかかることはなくなる
						count=count+1;//島の数をカウント
					}


				}


			}

			System.out.println(count);

		}

	}


}

class Human {

	int x;
	int y;//humanの現在の座標
	Human(){
		x= 0;
		y= 0;
	}
	boolean[][] map = new boolean[12][12]; //地図


	public void Advent(int x, int y){


		map[x][y]=false;//行ったことのある場所は海に

		//再帰処理で陸続きの場所をすべて沈める
		if(x<11){
			if(map[x+1][y]){
				Advent(x+1,y);
			}
		}
		if(x>0){
			if(map[x-1][y]){
				Advent(x-1,y);
			}
		}
		if(y<11){
			if(map[x][y+1]){
				Advent(x,y+1);
			}
		}
		if(y>0){
			if(map[x][y-1]){
				Advent(x,y-1);
			}
		}

	}



}




Measured memory_bytes: 25804
//#include <bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;


int main(void) {
	
	int a, b;

	cin >> a >> b;

	if (a > 8 || b > 8) {
		cout << ":(" << endl;
	}
	else {
		cout << "Yay!" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define td(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define int long long
using namespace std;
typedef vector<int> vi;
#define y1 abacaba
#define left sefude
typedef long long ll;
typedef pair<int,int> pii;
inline ll mod(ll n, ll m ){ ll ret = n%m; if(ret < 0) ret += m; return ret; }
ll gcd(ll a, ll b){return (b == 0LL ? a : gcd(b, a%b));}
ll exp(ll a,ll b,ll m){
    if(b==0LL) return 1LL;
    if(b==1LL) return mod(a,m);
    ll k = mod(exp(a,b/2,m),m);
    if(b&1LL){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}

const int N = 100100;
int cnt[N];

int32_t main(){
  fastio;
  int n;
  cin>>n;
  ll ans=0;
  for(int i=1;i<=n;i++){
    int x;
    cin >> x;
    cnt[x]++;
    ans+=x;
  }
  int q;
  cin>>q;
  while(q--){
    int b,c;
    cin>>b>>c;
    ans-=b*cnt[b];
    ans+=cnt[b]*c;
    cnt[c]+=cnt[b];
    cnt[b]=0;
    cout << ans << endl;
  }
  // Math -> gcd it all
  // Did u check N=1? Did you switch N,M?
}

Measured memory_bytes: 4396
package main
import (
   "fmt"
   "os"
   "bufio"
   "strconv"
)
var sc = bufio.NewScanner(os.Stdin)

func main() {
  sc.Split(bufio.ScanWords)
  var result []string
  for{
    m := nextInt()
    f := nextInt()
    r := nextInt()
	if m == -1 && f == -1 && r == -1 {
		break
	}

	if m == -1 || f == -1 {
      result = append(result, "F")
	  continue
	}

	if m + f >= 80 {
      result = append(result, "A")
	  continue
	}

	if 65 <= m + f && m + f < 80 {
      result = append(result, "B")
	  continue
	}

	if 50 <= m + f && m + f < 65 {
      result = append(result, "C")
	  continue
	}

	if 30 <= m + f && m + f < 50 {
	  if r >= 50 {
        result = append(result, "C")
	    continue
	  } else {
        result = append(result, "D")
	    continue
	  }
	}

	if m + f < 30 {
      result = append(result, "F")
	  continue
	}
  }
  length := len(result)
  for i := 0; i < length;i++ {
    fmt.Println(result[i])
  }
}

func getStdin() (string) {
	sc.Scan()
	v := sc.Text()
	return v
}

func nextInt() (int) {
	sc.Scan()
	v, e := strconv.Atoi(sc.Text())
    if e != nil { panic(e) }
    return v
}

func nextFloat() (float64) {
	sc.Scan()
	v, e := strconv.ParseFloat(sc.Text(), 64)
    if e != nil { panic(e) }
    return v
}



Measured memory_bytes: 1120
#include <iostream>
#include <vector>

using namespace std;

int main(){
  int W,H,x,y;
  cin >> W >> H >> x >> y;
  double ans = (double)W*H/2;
  int num = (W==x*2 && H==y*2) ? 1 : 0;
  printf("%.10f %d\n",ans,num);
}
  
  


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
#define pvec(vec) {for (auto v: vec) cout << v << ' '; cout << endl;}
#define pivec(vec) {rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' '; cout << endl;}

using namespace std;
using ll = long long;

vector<ll> primes;
void init_primes(ll N)
{
    vector<bool> is_prime(N+1, true);
    is_prime[0] = is_prime[1] = false;
    rep(i, 2, N+1)
    if (is_prime[i])
    {
        primes.push_back(i);
        for (ll j = (ll)i*i; j<=N; j += i)
            is_prime[j] = false;
    }
}

int main()
{
    init_primes(1000010);

    ll N;
    cin >> N;

    unordered_map<int, int> prime_cnt;
    for (auto prime: primes)
    while (N % prime == 0)
    {
        N /= prime;
        ++prime_cnt[prime];
    }
    if (N>1)
        ++prime_cnt[N];


    ll res = 0;
    for (auto elem: prime_cnt)
    {
        int cnt = elem.second;

        int num = 1;
        while (num*(1+num)/2 <= cnt)
            ++num;
        --num;
        
        res += num;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 4248
#include<bits/stdc++.h>
    using namespace std;
     
    typedef long long int ll;
    typedef long double ld;
     
    //****************************************************
    #define lp(var,start,end) for (ll var = start; var <end ; ++var)
    #define rlp(var,start,end) for(ll var = start; var>=end ; var--)
    #define pb push_back
    #define mp make_pair
    #define pf push_front
    #define ff first
    #define ss second
    #define vll vector<ll>
    #define pll pair<ll,ll> 
    #define vpll vector<pll>
    #define all(X) X.begin(),X.end()
    #define endl "\n" //comment it for interactive questions
    #define trace1(a) cerr << #a << ": " << a << endl;
    #define trace2(a,b) cerr << #a << ": " << a << " " << #b << ": " << b << endl;
    #define trace3(a,b,c) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << endl;
    #define trace4(a,b,c,d) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << #d << ": " << d << endl;
     
    #define MOD (ll)1e9+7; //change it for other mods
     
    #define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
    //*******************************************************
     
    //Some Functions
     
    ll powmod(ll a,ll b)
    {
    	ll res = 1;
    	while(b > 0) {
    		if(b & 1) res = (res * a) % MOD;
    		a = (a*a)%MOD;
    		b = b >> 1; 
    	}
    	return res % MOD;
    }
     
     
    int main()
    {
     	ll a,b,c;
     	cin >> a >> b >> c;
     	if(c - (a-b) < 0 ) cout << "0\n";
     	else 
     		cout << c - (a - b) << "\n";
    }

Measured memory_bytes: 256
read = input 
rn = lambda :list(map(int, read().split()))
n,m = rn()
S = []
for i in range(m):
    ks = rn()
    s = ks[1:]
    s = list(map(lambda x:x-1, s))
    S.append(s)
P = rn()
ans = 0
for i in range(1<<n):
    flag = True
    for p, s in zip(P,S):
        cnt = 0
        for swc in s:
            if (1<<swc) & i >0:
                cnt +=1
        if cnt % 2 != p:
            flag = False
            break;
#     print("%x"%i, p)
    if flag: ans+=1
print(ans)

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

const int M=1e5+5;
int h[M];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&h[i]);
	int dp0=1,dp1=1;
	for(int i=1;i<=n;i++)
	{
		int tmp0=0,tmp1=0;
		if(dp1&&h[i-1]-1<=h[i]) tmp0=1;
		if(dp0&&h[i-1]<=h[i]) tmp0=1;
		if(dp1&&h[i-1]-1<=h[i]-1) tmp1=1;
		if(dp0&&h[i-1]<=h[i]-1) tmp1=1;
		dp0=tmp0;
		dp1=tmp1;
	}
	printf("%s\n",dp0|dp1?"Yes":"No");
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>


typedef long double ld;
typedef long long ll;

using namespace std;

map<string, int> m;

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

	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		m[s]++;
	}
	int mmax = 0;
	for (map<string, int>::iterator it = m.begin(); it != m.end(); it++) {
		mmax = max((*it).second, mmax);
	}
	vector<string> ans;
	for (map<string, int>::iterator it = m.begin(); it != m.end(); it++) {
		if ((*it).second ==  mmax) {
			ans.push_back((*it).first);
		}
	}
	sort(ans.begin(), ans.end());
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 24764
N = int(input())
lis = [[int(i)for i in input().split()]for _ in range(N)]

if N ==1:
    print(1)
else:
    pqlis = []
    lis.sort()
    dxdic ={}
    for i in range(N):
        for j in range(i):
            dx = lis[i][0] -lis[j][0]
            if dx in dxdic.keys():
                dxdic[dx].append([i,j])
            else:
                dxdic[dx] =[[i,j]]
    ans = 0
    for li in dxdic.values():
        foo = 0
        dydic = {}
        for i,j in li:
            dy = lis[i][1] -lis[j][1]
            if dy in dydic.keys():
                dydic[dy] += 1
            else:
                dydic[dy] = 1
        foo = max(dydic.values())
        if ans < foo:
            ans = foo
    print(N-ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int CONTEST_NUM=26;

int score_function(const vector<int> &t,const vector<vector<int>> &s,const vector<int> &c,const int &d){
    vector<int> last(27);
    int manzoku=0;
    for(int i=1;i<=d;i++){
        manzoku+=s[i][t[i]];
        last[t[i]]=i;
        int sum=0;
        for(int j=1;j<=CONTEST_NUM;j++){
            sum+=c[j]*(i-last[j]);
        }
        manzoku-=sum;
    }
    return manzoku;
}

void set_ans(const vector<int> &t,vector<int> &ans,const int &d){
    for(int i=1;i<=d;i++){
        ans[i]=t[i];
    }
}

int main() {
    int d;cin>>d;
    vector<int> c(27);
    for(int i=1;i<=CONTEST_NUM;i++){
        cin>>c[i];
    }
    vector<vector<int>> s(d+1,vector<int>(27));
    for(int i=1;i<=d;i++){
        for(int j=1;j<=CONTEST_NUM;j++){
            cin>>s[i][j];
        }
    }
    vector<int> t(d+1);
    vector<int> ans(d+1);
    int old_ans=-1000000000;
    std::random_device rnd;
    std::mt19937 mt(rnd());
    std::uniform_int_distribution<> rand26(1,26);
    std::uniform_int_distribution<> randd(1,d);

    for(int i=1;i<=d;i++){
        int max_contest=-1;
        for(int j=1;j<=CONTEST_NUM;j++){
            if(max_contest<s[i][j]){
                max_contest=s[i][j];
                t[i]=j;
            }
        }
    }
    int k=0;
    while(k<120000){
        int che=randd(mt);
        int old_f=t[che];
        t[che]=rand26(mt);
        int tmp=score_function(t,s,c,d);
        if(tmp>old_ans){
            set_ans(t,ans,d);
            old_ans=tmp;
        }
        else{
            t[che]=old_f;
        }
        k++;
    }
    //cout<<old_ans<<endl;
    for(int i=1;i<=d;i++){
        cout<<ans[i]<<endl;
    }

    return 0;
}


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

int main(){
    string S,T;
    cin>>S>>T;
    int sleng = S.length();
    int tleng = T.length();
    int tmp = 0;
    int cnt = 0;
    for(int i=0;i<=sleng-tleng;i++){
        for(int j=0;j<tleng;j++){
            if(S.at(i+j)==T.at(j)){
                tmp++;
            }
        }
        if(tmp>cnt){
            cnt = tmp;
        }
        tmp = 0;
    }
    cout<<tleng-cnt;
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<map>
#include<string>
#include<stdlib.h>
#define ran(x) (x).begin(),(x).end()
using namespace std;
int main() {

	int n;
	cin >> n;
	vector<int> a(n);
	int64_t sum = 0;
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	for(int i = 1; i < n; ++i) {
		if(a[i - 1] > a[i]) {
			sum += a[i - 1] - a[i];
			a[i] += a[i - 1] - a[i];
		}
	}
	cout << sum << endl;
}

Measured memory_bytes: 3968
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ull  unsigned long long
#define pb push_back

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = 500000;
vector < int > g[N];

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("ou tput.txt", "w", stdout);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= m; i++){
        int u, v;
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
    sort(g[1].begin(), g[1].end());
    sort(g[n].begin(), g[n].end());
    int l1 = 0;
    int l2 = 0;
    while(l1 < g[1].size() && l2 < g[n].size()){
        if (g[1][l1] < g[n][l2]) l1++; else
        if (g[1][l1] > g[n][l2]) l2++; else{
            cout << "POSSIBLE";
            return 0;
        }
    }
    cout << "IMPOSSIBLE";
}


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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int N;
vector<string> ans;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<ll> A(N);
  for (auto &it : A)
    cin >> it;
  sort(A.begin(), A.end(), greater<ll>());

  if (N % 2 == 0)
  {
    ll res = 0;
    for (int i = 0; i < N / 2 - 1; i++)
      res += A[i] * 2;
    res += A[N / 2 - 1];
    res -= A[N / 2];
    for (int i = N / 2 + 1; i < N; i++)
      res -= A[i] * 2;
    cout << res << endl;
  }
  else
  {
    ll res1 = 0;
    for (int i = 0; i < N / 2 - 1; i++)
      res1 += A[i] * 2;
    res1 += A[N / 2 - 1] + A[N / 2];
    for (int i = N / 2 + 1; i < N; i++)
      res1 -= A[i] * 2;

    ll res2 = 0;
    for (int i = 0; i < N / 2; i++)
      res2 += A[i] * 2;
    res2 -= A[N / 2] + A[N / 2 + 1];
    for (int i = N / 2 + 2; i < N; i++)
      res2 -= A[i] * 2;
    cerr << res1 << " " << res2 << endl;
    cout << max(res1, res2) << endl;
  }
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1e9+7;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

template<class T> inline bool chmin(T &a,T b){
    if (a>b){
        a=b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T &a,T b){
    if (a<b){
        a=b;
        return true;
    }
    return false;
}

template<typename Monoid,typename Operator>
struct SegmentTree{
    private:
    typedef function<Monoid(Monoid,Monoid)> F;
    typedef function<Monoid(Monoid,Operator)> G;
    int n;
    F f;
    G g;
    Monoid id;
    vector<Monoid> dat;
    public:
    SegmentTree(int n_,F f,G g,Monoid id){
        this->f=f;
        this->g=g;
        this->id=id;
        init(n_);
    }
    void init(int n_){
        n=1;
        while(n<n_){
            n*=2;
        }
        dat.resize(2*n-1,id);
    }
    void build(int n_,vector<Monoid> v){
        rep(i,n_){
            dat[i+n-1]=v[i];
        }
        for (int i=n-2;i>=0;i--){
            dat[i]=f(dat[2*i+1],dat[2*i+2]);
        }
    }
    void update(int i,Operator a){
        i+=n-1;
        dat[i]=g(dat[i],a);
        while(i>0){
            i=(i-1)/2;
            dat[i]=f(dat[2*i+1],dat[2*i+2]);
        }
    }
    Monoid query(int a,int b,int k,int l,int r){
        if (r<=a||b<=l){
            return id;
        }
        if (a<=l&&r<=b){
            return dat[k];
        }
        Monoid vl=query(a,b,2*k+1,l,(l+r)/2);
        Monoid vr=query(a,b,2*k+2,(l+r)/2,r);
        return f(vl,vr);
    }
    Monoid query(int a,int b){
        return query(a,b,0,0,n);
    }
};

int main(){
    int N;
    cin >> N;
    vector<ll> h(N),a(N);
    rep(i,N) cin >> h[i],--h[i];
    rep(i,N) cin >> a[i];
    SegmentTree<ll,ll> Seg(N,[](ll a,ll b){return max(a,b);}
                            ,[](ll a,ll b){return a+b;},0);
    rep(i,N){
        ll M=Seg.query(0,h[i]+1);
        Seg.update(h[i],M+a[i]);
    }
    ll ans=Seg.query(0,N);
    cout << ans << endl;
}

Measured memory_bytes: 7424
import java.util.Scanner;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if(a == b){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
    sc.close();
  }
}


Measured memory_bytes: 35808
import java.util.LinkedList;
import java.util.Scanner;
import java.util.ArrayList;


class Graph {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	private int[] visited;
	private int[] distance;
	
	//adjacency list of edges
	public Graph() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		visited = new int[totalVertex];
		distance = new int[totalVertex];
		for(int i = 0; i< totalVertex; i++) {
			distance[i] = -1;
		}
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1;
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt() - 1;
				tmp.add(idx2);
			}	
			adjList.add(tmp);
		}
		in.close();
	}
	public void printAdjMatrix() {
		for(int k = 0; k < totalVertex; k++ ) {
			System.out.println(k + 1 + " " + distance[k]);
		}
	}
	
	public void BFS() {
		ArrayList<Integer> toVisit = new ArrayList<Integer>();
	    toVisit.add(0);
	    distance[0] = 0;
	    while(toVisit.size() > 0) {
	        //first-in, first-visit; if queue is used, use its dequeue() function
	        int v = toVisit.remove(0); 
	        visited[v] = 1;
	        LinkedList<Integer> neighbors = adjList.get(v);
	        for(int i = 0; i < neighbors.size(); i ++) {
	            int v1 = neighbors.get(i);
	            if((visited[v1] == 0) && (toVisit.contains(v1) == false)) {
	                toVisit.add(v1);
	                distance[v1] = distance[v] + 1;
	                visited[v1] = 1;
	            }
	        }
	    }
		
		
	}
}

//change class name GraphRepresentation to Main() for submission to AIZU
public class Main {
	public static void main(String argv[]) {
		Graph g = new Graph();
		g.loadAdjList();
		g.BFS();
		g.printAdjMatrix();
	}
}


Measured memory_bytes: 28576
#define DEBUG 0
#include <bits/stdc++.h>
#define loop(n) for (lint ngtkana_is_a_genius = 0; ngtkana_is_a_genius < lint(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (lint i = lint(begin); (i) < lint(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto&& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto&& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#if DEBUG
#define debug(...)\
  do {\
    std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_impl(__VA_ARGS__);\
    std::cerr << std::noboolalpha;\
  } while (false)
#else
#define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
 os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n; std::cin >> n;
  std::vector<int> a(n), b(n); std::cin>>a>>b;
  debug(a,b);

  auto cal = [&] (int P, auto a, auto b) {
    int ans = 0;
    int Q = 2 * P;
    for (int & x : a) x %= Q;
    for (int & y : b) y %= Q;
    std::sort(all(b));
    for (int x : a) {
      auto it1 = std::lower_bound(all(b), 1*P - x);
      auto it2 = std::lower_bound(all(b), 2*P - x);
      auto it3 = std::lower_bound(all(b), 3*P - x);
      auto it4 = std::lower_bound(all(b), 4*P - x);
      debug(std::vector<int>(it1,it2),std::vector<int>(it3,it4));
      int count0 = it2 - it1;
      int count1 = it4 - it3;
      int now = count0 + count1;
      ans += now;
    }
    debug(P,a,b,ans);
    return ans;
  };
  int ans = 0;
  int P = 1;
  rep(p,0,29) {
    int now = cal(P, a, b);
    ans |= (now & 1) << p;
    P *= 2;
  }
  std::cout << ans << std::endl;
  return 0;
}

/*
桁と a の添字ごとに分解して考えます。
p 桁目で、a の要素が x だとして、for y in b で (x + y)[p] の総 xor を求めましょう。
P = pow(2, p) と置くと、a, b は 2*P で割った余りを考えればよいです。
このとき、(x + y)[p] が 1 になる条件は y in [P-x, 2*P-x[ `union` [3*P-x, 4*P-x[ です。
これの数を数えればよいです。
*/


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define deb(x) cout<<#x<<" " <<x<<"\n";
#define pi 3.1415926535897932384626433832795
#define mod 1000000007
#define all(x) x.begin(), x.end()
#define cr7 ios_base::sync_with_stdio(false);cin.tie(NULL);
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (((a)*(b))/gcd((a),(b)))
int main()
{
	cr7
#ifndef ONLINE_JUDGE
	freopen("input2.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	ll n;
	cin >> n;
	ll arr[n + 1]; unordered_map<ll, ll> mp;
	ll pos[n + 1], neg[n + 1];
	set<ll> vec;
	for (ll i = 1; i <= n; ++i) {
		cin >> arr[i];
		pos[i] = i + arr[i]; //mp[pos[i]]++;
		neg[i] = i - arr[i];
		if (neg[i] > 1) {
			vec.insert(neg[i]); mp[neg[i]]++;
		}
	}
	ll cnt = 0;
	for (ll i = 1; i <= n; ++i) {
		if (mp[pos[i]] > 0) {
			cnt += mp[pos[i]];
		}
	}
	/*for (auto it : mp) {
		if (it.second > 0) {
			cnt += ((it.second) * (it.second - 1)) / 2;
		}
	}*/
	cout << cnt << "\n";
	return 0;
}

Measured memory_bytes: 21280
#include<stdio.h>
#include<stdio.h>
int main(void)
{
  int n,i;
  int pt=0,ph=0;
  char taro[101],hana[101];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s", taro, hana);
    // printf("%d %d\n",taro[0],hana[0]);
    if(strcmp(taro,hana)>0) pt+=3;
       else if (strcmp(taro,hana)<0) ph+=3;
    else{
      pt++;
      ph++;
    }
  }
  printf("%d %d\n",pt,ph);
  return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1234567;
char s[MAXN];
int f[MAXN];
int nxt[MAXN],prv[MAXN];
int main()
{
    int n;
    scanf("%d", &n);
    scanf("%s", s);
    memset(f,0,sizeof(f));
    nxt[n] = n;
    for(int i = n-1; i >= 0; --i)
    {
        if(s[i] == '0')
            nxt[i] = i;
        else
            nxt[i] = nxt[i+1];
    }
    for(int i = 0; i < n; ++i)
    {
        if(s[i] == '0')
            prv[i] = i;
        else
            prv[i] = (i==0?-1:prv[i-1]);
    }
    for(int i = 0; i  <= n; ++i)
    {
        if(i >= 3 && s[i-1] == '1' && s[i-2] == '0' && s[i-3] == '1')
        {
            int j = prv[i-3];
            f[i] = max(f[i],f[j+1]+(i-j-3));
            if(j != i-4)
                f[i] = max(f[i],f[j+2]+(i-j-4));
        }
        if(i == n)
            break;
        if(i+3 <= n && s[i] == '1' && s[i+1] == '0' && s[i+2] == '1')
        {
            int j = nxt[i+2];
            f[j] = max(f[j],f[i]+(j-i-2));
            if(j != i+3)
                f[j-1] = max(f[j-1],f[i]+(j-i-3));
        }
        f[i+1] = max(f[i+1],f[i]);
    }
    printf("%d\n",f[n]);
    return 0;
}

Measured memory_bytes: 13056
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define watch(x) cout<<"->"<<#x<<" : "<<x<<endl;
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c)) 
#define all(v) (v).begin(),(v).end()
typedef long long ll;
typedef unsigned long long llu;
const double PI = 2*acos(0.0);
#define int long long
signed main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a,b;
	cin>>a>>b;
	int needa = a*2;
	if(b>=needa)b-=needa;
	else
	{
		cout<<b/2<<endl;
		exit(0);
	}
	cout<<a+(b/4)<<endl;
	return 0;
}

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

#define IOS cin.tie(0);ios_base::sync_with_stdio(false)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>
using Graph  =  vector<vector<int>>;

#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())
#define END cout<<"\n"

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define SRepS(i,n,m)    for(int i=(int)(n);i*i<=(int)(m);i++)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template<class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define VCIN(x) for(auto &item:x) cin>>item

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?" ":"\n"); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);} //最小公倍数
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
template<class T>bool comp(T a,T b){return abs(a)<abs(b);} //比較関数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int NMAX = 200;
const int INF = 1e9;
const int MOD = 1e9+7;
bool flag;

//----------------------Global-------------------------//


signed main(){
    CIN(N,M);
    vi x(M);VCIN(x);
    sort(all(x));
    rep(i,M-1)x[i]=abs(x[i+1]-x[i]);
    x[M-1]=0;
    sort(all(x),greater<int>());
    int ans=0;
    Rep(i,N-1,M-1)ans+=x[i];
    printf("%d\n",ans);

    return 0;
}

Measured memory_bytes: 640
#include <cstdio>
int main() {
	int r, g, b, s = 0;
	scanf("%d%d%d", &r, &g, &b);
	s = s * 10 + r;
	s = s * 10 + g;
	s = s * 10 + b;
	if(s%4 == 0)
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
} 

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SelfCSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            var array = Console.ReadLine().Split(' ');

            var maxi = int.Parse(array[0]);
            var cnt = 0;

            for (int i = 0;i < n;i++)
            {
                if(maxi <= int.Parse(array[i]))
                {
                    maxi = int.Parse(array[i]);
                    cnt++;
                }
            }
            Console.WriteLine(cnt); 
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;

typedef pair<int, int> P;

int h, w;
char a[1010][1010];
int b[1010][1010];

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

const int INF = 99999999;

int ans = 0;

queue<P> que;

void bfs() {
  int count;
  while (que.size()) {
    P p = que.front(); que.pop();
    for (int i = 0; i < 4; i++) {
      int nx = p.first + dx[i];
      int ny = p.second + dy[i];

      if (nx >= 1 && nx <= h && ny >= 1 && ny <= w) {
        if (b[nx][ny] > b[p.first][p.second] + 1) {
          que.push(P(nx, ny));
          b[nx][ny] = b[p.first][p.second] + 1;
        }
      }
    }
  }
}

int main () {
  cin >> h >> w;
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      cin >> a[i][j];
      if (a[i][j] == '#') {
        b[i][j] = 0;
        que.push(P(i, j));
      } else {
        b[i][j] = INF;
      }
    }
  }

  bfs();

  for (int i = 1; i <=h ; i++) {
    for (int j = 1; j <= w; j++) {
      ans = max(ans, b[i][j]);
    }
  }


  cout << ans << endl;

}


Measured memory_bytes: 13456
from itertools import permutations
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
p = q = 0
for i,v in enumerate(permutations([i+1 for i in range(N)],N)):
    if P == v:
        p = i
    if Q == v:
        q = i
print(abs(q - p))


Measured memory_bytes: 3060
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int[] i1 = new int[3];
        int[] i2 = new int[3];
        int[] i3 = new int[3];
        
        for (int i = 0; i < 3; i++) {
            i1[i] = sc.nextInt();
        }
        for (int i = 0; i < 3; i++) {
            i2[i] = sc.nextInt();
        }
        for (int i = 0; i < 3; i++) {
            i3[i] = sc.nextInt();
        }
        
        int diff21 = i2[0] - i1[0];
        int diff31 = i3[0] - i1[0];
        
        if (i2[1] - i1[1] == diff21 && i2[2] - i1[2] == diff21 &&
                i3[1] - i1[1] == diff31 && i3[2] - i1[2] == diff31) {
            System.out.println("Yes");
            
        } else {
            System.out.println("No");
            
        }
    }
}

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

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    char s[4];
    cin >> s;
    if(s[0] == '7' || s[1] == '7' || s[2] == '7')
        cout << "Yes";
    else
        cout << "No";
    cout << "\n";
    return 0;
}


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

int N, ans;
char S[200100];
int titik[200100], pagar[200100];

int main () {
	cin >> N;
	for(int i=1; i<=N; i++) {
		cin >> S[i];
		if (S[i]=='.') {
			titik[i] = titik[i-1]+1;
			pagar[i] = pagar[i-1];
		} else {
			titik[i] = titik[i-1];
			pagar[i] = pagar[i-1]+1;
		}
	}
	ans=N;
	for(int i=0; i<=N; i++) {
		ans = min(ans, pagar[i]+titik[N]-titik[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2048
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <string>
using namespace std;
const int INF = 2000000005;
int dp[10005][10005] = { 0 };

int main() {
	string t, b;
	cin >> t >> b;
	for (int i = 0; i < 10005; i++) dp[0][i] = 1;
	int tl = t.length(), bl = b.length();
	for (int i = 1; i <= bl; i++) {
		for (int j = 1; j <= tl; j++) {
			dp[i][j] = dp[i][j - 1];
			if (t[j - 1] == b[i - 1]) dp[i][j] += dp[i - 1][j - 1];
			dp[i][j] %= 1000000007;
			/*cout << dp[i][j] << " ";*/
		}
		/*cout << endl;*/
	}
	cout << dp[bl][tl] << endl;
	return 0;
}


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

int main() {
    long N, K, n;
    cin >> N >> K;
    if (N % K == 0) {
        cout << 0 << endl;
        return 0;
    }
    if (K % N == 0) {
        cout << N << endl;
        return 0;
    }
    n = N % K;
    do {
        N = n;
        n = abs(N - K);
    } while (N > n);
    
    cout << N << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int n,d,x,i,j;
  scanf("%d%d%d",&n,&d,&x);
  int a[100];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  int sum=x;
  for(i=0;i<n;i++){
    for(j=0;j<d;j++){
      if(j*a[i]+1<=d) sum+=1;
    }
  }
  printf("%d",sum);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define F first
#define S second
#define pi pair <ll, ll>
#define pii pair <pi, pi>
#define all(x) (x).begin(), (x).end()
#define mod 1000000007
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll T = 1;
	//cin >> T;
	while(T--){	
		ll a, b;
		cin >> a >> b;
		cout << a * b;
	}	
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)



int cd=270000;

int d,c[26],s[366][26];
int t[366];
ll r;

void init(){
    cin>>d;
    REP(i,26)cin>>c[i];
    REP(i,d)REP(j,26)cin>>s[i][j];
}

void greedy(){
    REP(i,d)REP(j,26)t[i]=s[i][j]>s[i][t[i]]?j:t[i];
}

ll score(int *t){
    ll ans=0;vector<int>cnt(26,0);
    REP(i,d){
        cnt[t[i]]=-1;
        ans+=s[i][t[i]];
        REP(j,26)cnt[j]++,ans-=cnt[j]*c[j];
    }
    return ans;
}

void crt_new(){
    int idx=rand()%d;
    int q=rand()%26;
    while(q==t[idx])q=rand()%26;
    int tmp=t[idx];
    t[idx]=q;
    ll res=score(t);
    if(res>r)r=res;
    else t[idx]=tmp;
}

void solve()
{

    init();
    // ll begin_t=clock();
    greedy();
    r=score(t);
    while(cd--)crt_new();
    // REP(i,d)cout<<t[i]<<" ";cout<<endl;
    REP(i,d)cout<<t[i]+1<<endl;
    // cout<<r<<endl;

    // ll end_t=clock();cout<<end_t-begin_t<<"ms"<<endl;
}

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

Measured memory_bytes: 3660
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <climits>
#include <math.h>
#include <bitset>

#define P pair
#define X first
#define Y second
#define VSORT(v) sort(v.begin(), v.end())
#define VREV(v) reverse(v.begin(), v.end())
#define VMAX_P(v) max_element(v.begin(), v.end())
#define VMIN_P(v) min_element(v.begin(), v.end())
#define VMAX_IDX(v) distance(v.begin(), VMAX_P(v))
#define VMIN_IDX(v) distance(v.begin(), VMIN_P(v))
#define VCOPY(src, dst) copy(src.begin(), src.end(), back_inserter(dst))
#define SUPPER(src, dst) transform(src.begin(), src.end(), dst.begin(), toupper);
#define SLOWER(src, dst) transform(src.begin(), src.end(), dst.begin(), tolower);

using namespace std;
using ll = long long;

void displayVec(vector<int> v)
{
    for (int i = 0; i < v.size(); i++)
    {
        cout << v[i] << endl;
    }
    cout << endl;
}

int binarySearch(vector<int> v, int target)
{
    int left = -1;
    int right = v.size();

    while (right - left > 1)
    {
        int mid = left + (right - left) / 2;

        if (v[mid] >= target)
        {
            right = mid;
        }
        else
        {
            left = mid;
        }
    }

    if (right < v.size() && v[right] == target)
    {
        return right;
    }
    return -1;
}

int countDays(int year, int month, int day)
{
    int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int cnt = day;

    if (month == 1)
    {
        return cnt;
    }

    for (int i = 0; i < month - 1; i++)
    {
        cnt += days[i];
    }

    if (month >= 3 && ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0))
    {
        cnt++;
    }

    return cnt;
}

int main(int argc, const char *argv[])
{
    int n;
    vector<int> a(n), b(n - 1);

    cin >> n;
    for (int i = 0; i < n - 1; i++)
    {
        cin >> b[i];
    }

    a[0] = b[0];
    a[n - 1] = b[n - 2];
    for (int i = n - 2; i > 0; i--)
    {
        a[i] = min(b[i], b[i - 1]);
    }

    ll sum = 0;
    for (int i = 0; i < n; i++)
    {
        sum += a[i];
    }
    cout << sum << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,l,r) for (int i=l,i##end=r;i<=i##end;++i)
#define per(i,r,l) for (int i=r,i##end=l;i>=i##end;--i)
#define ll long long
#define pr pair<int,int>
#define mp make_pair
#define fi first
#define se second
using namespace std;
const int N=1e6+6;
int main(){
    int n,l; cin>>n>>l;
    if (2*l>n+1){ cout<<-1<<endl; return 0; }
    if (n&1){
        int t=n+1>>1;
        rep(i,1,t) printf("%d %d %d\n",l+2*(i-1),l+3*t-1-i,l+4*t-3+i);
        rep(i,1,t-1) printf("%d %d %d\n",l+1+2*(i-1),l+4*t-2-i,l+5*t-3+i);
    }
    else{
        int t=n>>1;
        rep(i,1,t) printf("%d %d %d\n",l+2*(i-1),l+3*t-i,l+4*t-1+i);
        rep(i,1,t) printf("%d %d %d\n",l-1+2*i,l+4*t-i,l+5*t-1+i);
    }
    return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(a) int((a).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
template<class T, class U> inline void add_self(T &a, U b){a += b;if (a >= mod) a -= mod;if (a < 0) a += mod;}
template<class T, class U> inline void min_self(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void max_self(T &x, U y) { if (y > x) x = y; }

#define _deb(x) cout<<x;
void _print() {cerr << "]\n";} template <typename T, typename... V>void _print(T t, V... v) {_deb(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
template <class T, class U> void print_m(const map<T,U> &m, int w=3){if(m.empty()){cout<<"Empty"<<endl; return;}for(auto x: m)cout<<"("<<x.first<<": "<<x.second<<"),"<<endl;cout<<endl;}
template<class T, class U>void debp(const pair<T, U> &pr, bool end_line=1){cout<<"{"<<pr.first<<" "<<pr.second<<"}"; cout<<(end_line ? "\n" : ", ");}
template <class T> void print_vp(const T &vp, int sep_line=0){if(vp.empty()){cout<<"Empty"<<endl; return;}if(!sep_line) cout<<"{ ";for(auto x: vp) debp(x,sep_line);if(!sep_line) cout<<"}\n";cout<<endl;}
template <typename T>void print(const T &v, bool show_index = false){int w = 2;if(show_index){for(int i=0; i<sz(v); i++)cout<<setw(w)<<i<<" ";cout<<endl;}for(auto &el: v) cout<<setw(w)<<el<<" ";cout<<endl;}
template <typename T>void print_vv(const T &vv){if(sz(vv)==0) {cout<<"Empty"<<endl; return;} int w = 3;cout<<setw(w)<<" ";for(int j=0; j<sz(*vv.begin()); j++)cout<<setw(w)<<j<<" ";cout<<endl;int i = 0;for(auto &v: vv){cout<<i++<<" {";for(auto &el: v) cout<<setw(w)<<el<<" ";cout<<"},\n";}cout<<endl;}

int main(){
    int n;
    while(cin>>n){
        n = n%1000;
        n = (1000 - n)%1000;
        cout<<n<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
using namespace std;
const int maxn = 200010;
//定义链表结构体
struct At {
	char c;		//该位置字符
	At* last;   //上一个节点
	At* next;   //下一个节点
}	c[maxn];
//主函数
int main() {
	//使用cin>>string以方便读入
	string s;
	cin >> s;

	//转存到链表中
	int size = s.size();
	///第一个节点和最后一个节点需要单独处理
	c[0] = { s[0],NULL,&c[1] };						///第一个节点的前一个节点为空
	///遍历中间的size-2个节点
	for (int i = 1; i < size - 1; i++) {
		c[i] = { s[i],&c[i - 1],&c[i + 1] };
	}
	c[size - 1] = { s[size - 1],&c[size - 2],NULL };///最后一个节点的后一个节点为空

	//
	At* now = &c[0];
	while (true) {
		int update = 0;
		for (At* i = now; i->next != NULL; i = i->next) {
			if (i->c == 'S'&&i->next->c == 'T') {
				if (i->last != NULL) {
					now = i->last;
					now->next = i->next->next;
					if (i->next->next != NULL)
						i->next->next->last = now;
				}
				else {
					now = i->next->next;
					if (i->next->next != NULL)
						i->next->next->last = NULL;
				}
				size -= 2;
				update = 1;
				break;
			}
		}
		if (!update || size == 0 || now == NULL)
			break;
	}
	cout << size << endl;
	return 0;
}


Measured memory_bytes: 5244
#include <iostream>
#include <vector>
#include <string>

int main()
{
    int h, w;
    std::cin >> h >> w;
    std::vector<std::string> buffer;
    buffer.reserve(h);
    for (int i = 0; i < h; ++i)
    {
        std::string tmp;
        std::cin >> tmp;
        buffer.emplace_back(std::move(tmp));
    }

    for (int i = 0; i < 2 * h; ++i)
    {
        std::cout << buffer[i / 2] << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdint.h>
#include <math.h>
#define MIN(x, y) ((x)<(y)?(x):(y))
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define rep(i,n) FOR(i,0,n)

int n;
int64_t a[114514], asum[114514];

int main() {
    scanf("%d", &n);
    rep(i, n)
        scanf("%ld", a + i);
    
    int minus = 0, zero = 0;
    int64_t tot = 0, mini = (1LL << 62);
    rep(i, n) {
        minus += a[i] < 0;
        tot += abs(a[i]);
        zero |= a[i] == 0;
        mini = MIN(mini, abs(a[i]));
    }
    
    if (minus % 2 == 0 || zero)
        printf("%ld", tot);
    else
        printf("%ld", tot - 2 * mini);
}

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


int main()
{
	auto& in = cin;
	string N;
	in >> N;
	long long sum = 0;
	for (size_t i = 0; i < N.length(); ++i) {
		stringstream sstr;
		sstr << N[i];
		long long num;
		sstr >> num;
		sum += num;
	}
	if ((sum % 9) == 0)
		cout << "Yes";
	else
		cout << "No";

	return 0;
}


Measured memory_bytes: 3764
K, N = list(map(int, input().split()))
houses = list(map(int, input().split()))

min_dist = K
for i in range(N):
	if i == 0:
		dist = houses[-1] - houses[i]
	else:
		dist = houses[i] - houses[i-1]
		dist = K - dist
			
	if dist < min_dist:
		min_dist = dist
		
print(min_dist)

Measured memory_bytes: 32236
n=int(input())
s=input()
w=s.count(".")
ww=0
b=s.count("#")
bb=0
ans=[bb+w]
for i in range(n):
	if s[i]==".":
		w-=1
		ww+=1
	else:
		b-=1
		bb+=1
	ans.append(bb+w)
print(min(ans))

Measured memory_bytes: 11264
import math
N = int(input())

g = 1000003

fr = [1] * g
for x in range(2, g):
    fr[x] = x * fr[x-1] % g

def div(a, b):
    return a * pow(b, g-2, g) % g

for x, d, n in (map(int, input().split()) for _ in range(N)):
    ans = 1

    if d == 0:
        print(pow(x, n, g))

    else:
        s = div(x, d)
        x, y = s+n-1, s-1
        if s+n-1 < g :
            print(div(fr[x], fr[y]) * pow(d, n, g) % g)
        else:
            print(0)

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

int main() {
    int n;
    cin>>n;
    long h;
    long ma=0;
    rep(i,n){
        cin>>h;
        if(h<(ma-1)){
            cout<<"No"<<endl;
            return 0;
        }
        ma=max(ma,h);
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int MX = 600005;
int n, p[13][MX], fin[13][MX], res[MX];
string t;

void go (int i, int m) {
	vector<vi> a(3, vi(m));

	forn (j, 3 * m) a[j / m][j % m] = j / m;

	fin[i][0] = 3 * m - 1;

	forn (j, t.size()) {
		if (t[j] == 'S') {
			swap(a[1], a[2]);
		} else {
			vi aux(3);
			forn (k, 3) aux[k] = a[k][fin[i - 1][j]];
			forn (k, 3) a[(k + 1) % 3][fin[i - 1][j]] = aux[k];
		}

		fin[i][j + 1] = fin[i - 1][j + 1] + m * a[2][fin[i - 1][j + 1]];
	}

	forn (j, 3 * m) p[i][j] = p[i - 1][j % m] + m * a[j / m][p[i - 1][j % m]];
}

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> n >> t;

	iota(p[0], p[0] + 3, 0);

	fin[0][0] = 2;
	forn (i, t.size()) {
		swap(p[0][1], p[0][2]);
		if (t[i] == 'R') swap(p[0][0], p[0][1]);
		fin[0][i + 1] = p[0][2];
	}

	int m = 3;
	for (int i = 1; i < n; i++, m *= 3)
		go(i, m);

	forn (i, m) res[p[n - 1][i]] = i;

	forn (i, m) cout << res[i] << " ";
	cout << endl;

	return 0;
}


Measured memory_bytes: 20196