akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

typedef pair<int, int> P;

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

int H, W;
int field[8][8];
bool arrive[8][8][8][8][8][8];

void init(){
  memset(field, 0, sizeof(field));
  memset(arrive, false, sizeof(arrive));
}

bool canArrive(int bx, int by, int sx, int sy){
  int tmp_field[8][8];
  memset(tmp_field, 0, sizeof(tmp_field));
  for(int i = 0 ; i < H ; i++){
    for(int j = 0 ; j < W ; j++){
      if(field[i][j] != 1) tmp_field[i][j] = 0;
      else tmp_field[i][j] = field[i][j];
    }
  }
  
  tmp_field[by][bx] = 2;

  queue<P> que;
  que.push(P(sx, sy));
  while(!que.empty()){
    P q = que.front(); que.pop();
    arrive[by][bx][sy][sx][q.second][q.first] = true;
    
    for(int i = 0 ; i < 4 ; i++){
      int nx = q.first + dx[i], ny = q.second + dy[i];
      if(nx < 0 || nx >= W || ny < 0 || ny >= H) continue;
      if(tmp_field[ny][nx] != 0) continue;
      if(arrive[by][bx][sy][sx][ny][nx]) continue;
      que.push(P(nx, ny));
    }    
  }
}


struct State{
  int x, y, sx, sy, cost;
  State(int x, int y, int sx, int sy, int cost) : x(x), y(y), sx(sx), sy(sy), cost(cost){}
};

const bool operator < (const State &a, const State &b){
  return a.cost > b.cost;
}

int bfs(){
  int sx, sy, bx, by;
  for(int i = 0 ; i < H ; i++){
    for(int j = 0 ; j < W ; j++){
      if(field[i][j] == 2) bx = j, by = i;
      if(field[i][j] == 4) sx = j, sy = i;
    }
  }
  
  priority_queue<State> que;
  que.push(State(bx, by, sx, sy, 0));
  
  bool used[8][8][8][8];
  memset(used, false, sizeof(used));
  
  while(!que.empty()){
    State p = que.top(); que.pop();

    if(field[p.y][p.x] == 3) return p.cost;    

    if(used[p.y][p.x][p.sy][p.sx]) continue;
    used[p.y][p.x][p.sy][p.sx] = true;
    
    for(int i = 0 ; i < 4 ; i++){
      int nx1, nx2, ny1, ny2;
      nx1 = p.x + dx[i], ny1 = p.y + dy[i];
      nx2 = p.x - dx[i], ny2 = p.y - dy[i];
      if(nx1 < 0 || nx1 >= W || ny1 < 0 || ny1 >= H ||
	 nx2 < 0 || nx2 >= W || ny2 < 0 || ny2 >= H) continue;
      if(field[ny1][nx1] == 1) continue;
      if(field[ny2][nx2] == 1) continue;
      if(!arrive[p.y][p.x][p.sy][p.sx][ny2][nx2]) continue;      
      que.push(State(nx1, ny1, nx2, ny2, p.cost+1));
    }    
  }
  return -1;
}

int main(){
  while(cin >> W >> H, W|H){
    init();
    
    for(int i = 0 ; i < H ; i++)
      for(int j = 0 ; j < W ; j++) cin >> field[i][j];
    
    for(int by = 0 ; by < H ; by++){
      for(int bx = 0 ; bx < W ; bx++){
	if(field[by][bx] == 1) continue;
	for(int sy = 0 ; sy < H ; sy++){
	  for(int sx = 0 ; sx < W ; sx++){
	    if(sy == by && sx == bx) continue;
	    if(field[sy][sx] == 1) continue;
	    canArrive(bx, by, sx, sy);
	  }
	}
      }
    }

    cout << bfs() << endl;
    
  }

  return 0;
}

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

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

        int x = sc.NextInt();

        string answer = x == 3 || x == 5 || x == 7 ? "YES" : "NO";

        Console.WriteLine(answer);
    }

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

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

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

            return _line[_index++];
        }

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

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

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

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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB emplace_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

int main(){
    string s;
    cin >> s;
    string ans = "Good";
    REP(i, 3) if(s[i]==s[i+1]) ans = "Bad";
    cout << ans;
    return 0;
}

Measured memory_bytes: 3572
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
int a,b,c;
int main(){
	cin>>a>>b>>c;
	int R=a;
	R=max(R,b);
	R=max(R,c);
	cout<<a+b+c-R<<endl;
	return 0;
}


Measured memory_bytes: 256
// C++ 14
#include <bits/stdc++.h>
using namespace std;
template <typename T>  ostream& operator<<(ostream& os, const vector<T>& v)  {  os << "[";  for (int i = 0; i < v.size(); ++i) {  os << v[i];  if (i != v.size() - 1)  os << ", ";  }  os << "]";  return os;  }
template <typename T> void print(T v, string s = "\n") { cout << v << s; }
template <typename T> void in(T& v) { cin >> v; }
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

/*
3色.
|
|
--
--
1 2
---
2 1
2 3
3 1

*/
const ll MOD = 1000000007;
int main() {
  int n;in(n);
  string s, t;in(s),in(t);
  int i = 0;
  ll ans = 1;
  int prev = -1; // -1 None, 0 |, 1 --
  while (i < n) {
    if (s[i] == t[i]) {
      if (prev == -1) {
        ans *= 3;
      } else if (prev == 0) {
        ans *= 2; ans %= MOD;
      } else {
        // ans *= 1;
      }
      prev = 0;
      i++;
      continue;
    }
    
    if (prev == -1) {
      ans *= 6;
    } else if (prev == 0) {
      ans *= 2; ans %= MOD;
    } else {
      ans *= 3; ans %= MOD;
    }
    prev = 1;
    i += 2;
  }
  print(ans);
  return 0;
}


Measured memory_bytes: 3632
import sys

while True :
	h,w = map(int,raw_input().split())
	if h==0 and w==0:
		break
	else :
		i,j=[0,0]
		for num in range(h):
			j = 0
			if i==0 or i==h-1 :
				print '#'*w
			else :
				for nnum in range(w):
					if j==0 : 
						sys.stdout.write('#')
						j += 1
					elif j==w-1 :
						sys.stdout.write('#\n')
						j += 1
					else :
						sys.stdout.write('.')
						j += 1
			i += 1
	print''

Measured memory_bytes: 6356
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;
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; }

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

int main(){
    ll n;
    ll INF = 1001001001001001;
    cin >> n;
    ll a[n];
    rep(i, n) cin >> a[i];
    vvec<ll> dp(n+1, vec<ll>(n+1, INF));
    vec<ll> s(n+1);
    rep(i, n) dp[i][i+1] = 0;
    rep(i, n) s[i+1] += s[i] + a[i];
    for(int j=2; j<=n; j++) for(int i=0; i+j<=n; i++) {
        for(int k=i+1; k<i+j; k++) {
            dp[i][i+j] = min(dp[i][i+j], dp[i][k] + dp[k][i+j] + s[i+j] - s[i]);
        }
    }
    cout << dp[0][n] << endl;
}

Measured memory_bytes: 1536
N = int(input())

S = 'abcdefghijklmnopqrstuvwxyz'

def bite(X):
    s = 0
    t = 0
    while t < X:
        t = t + 26**(s+1)
        s = s + 1
    return s


B = bite(N)
X = N
L = []
for i in range(B):
    if X%26 != 0:
        L.append(X%26)
        X = (X-X%26)//26
    else:
        L.append(26)
        X = (X - 26)//26

L.reverse()

ans = ''
for i in range(B):
    ans = ans + S[L[i]-1]

    
print(ans)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
const ll mod=1000000007;
const ll INF=1e15;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
struct edge{ ll to; ll cap; ll rev;};
const ll MAXN=20005;
vector<edge> G[MAXN];
ll Start=MAXN-2, Goal=MAXN-1;
bool used[MAXN];
vector<int> dx={1,0,-1,0}, dy={0,1,0,-1};

void addEdge0(ll from, ll to, ll cap){
    edge A={to,cap,(ll)G[to].size()};
    edge B={from,0,(ll)G[from].size()};
    G[from].push_back(A);
    G[to].push_back(B);
    return;
}//有向グラフを作る

void addEdge1(ll a, ll b, ll cap){
    edge A={b,cap,(ll)G[b].size()};
    edge B={a,cap,(ll)G[a].size()};
    G[a].push_back(A);
    G[b].push_back(B);
    return;
}//無向グラフを作る

ll dfs(ll v, ll t, ll f){
    if(v==t) return f;
    used[v]=true;
    rep(i,G[v].size()){
        edge &e=G[v][i];
        if(!used[e.to] && e.cap>0){
            ll d=dfs(e.to,t,min(f,e.cap));
            if(d>0){
                e.cap-=d;
                G[e.to][e.rev].cap+=d;
                return d;
            }
        }
    }
    return 0;
}



ll MaxFlow(){
    ll ans=0;
    while(true){
        rep(i,MAXN) used[i]=false;
        ll P=dfs(Start,Goal,INF);
        if(P==0) break;
        ans+=P;
    }
    return ans;
}

int main(){
    ll H,W; cin>>H>>W;
    bool able=true;
    rep(i,H) {
        string S; cin>>S;
        rep(j,W) {
            ll K=100*i+j;
            if(S.at(j)=='X'){
                if(i==0 || i==H-1 || j==0 || j==W-1) able=false;
                addEdge0(Start,K,INF);
                addEdge0(K,K+10000,INF);
            }
            else addEdge0(K,K+10000,1);
        }
    }
    if(!able) cout<<-1<<endl;
    else{
        rep(i,H-1) rep(j,W-1) {
            ll K=100*i+j;
            
            rep(k,2) {
                ll J=100*(i+dy.at(k))+j+dx.at(k);
                addEdge0(J+10000,K,INF);
                addEdge0(K+10000,J,INF);
            }

        }
        rep(i,H) rep(j,W) if(i==0 || i==H-1 || j==0 || j==W-1) {
            ll K=100*i+j;
            addEdge0(K+10000,Goal,1);
        }

        cout<<MaxFlow()<<endl;

    }
}

Measured memory_bytes: 5632
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <ios>

int main()
{
  long long W, H, x, y;
  std::cin >> W >> H >> x >> y;

  long double area = (long double)(W * H) * 0.5;
  char dup = (2*x==W&&2*y==H) ? '1' : '0';

  std::cout << std::fixed << std::setprecision(9) << area << " " << dup << std::endl;

  return 0;
}

Measured memory_bytes: 256
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let m1: u64 = sc.read();
    let d1: u64 = sc.read();
    let m2: u64 = sc.read();
    let d2: u64 = sc.read();
    if m1 != m2 {
        println!("1");
    } else {
        println!("0");
    }
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define INF 1234567890123456789
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
	int n,x;
	string s,ans;
	cin>>n>>s>>x;
	ans=s;
	int pnt=0;
	while(x){
		if(s[pnt]=='0'){
			ans[pnt]='1';
			x--;
		}
		if(pnt==n-1)break;
		pnt++;
	}
	while(x){
		if(s[pnt]=='1'){
			ans[pnt]='0';
			x--;
		}
		pnt--;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3216
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <random>
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)++)

class Dice {
    vector<int> v;
public:
    Dice(int a, int b, int c, int d, int e, int f);
    int getTop();
    int getFront();
    void east();
    void south();
    void north();
    void west();
    vector<int> getContents();
    void random();
};

Dice::Dice(int a, int b, int c, int d, int e, int f) {
    v.push_back(a);
    v.push_back(b);
    v.push_back(c);
    v.push_back(d);
    v.push_back(e);
    v.push_back(f);
}

int Dice::getTop() {
    return v[0];
}

int Dice::getFront() {
    return v[1];
}

void Dice::east() {
    vector<int> e;
    e.push_back(v[3]);
    e.push_back(v[1]);
    e.push_back(v[0]);
    e.push_back(v[5]);
    e.push_back(v[4]);
    e.push_back(v[2]);
    REP(i,6) v[i] = e[i];
}

void Dice::south() {
    vector<int> e;
    e.push_back(v[4]);
    e.push_back(v[0]);
    e.push_back(v[2]);
    e.push_back(v[3]);
    e.push_back(v[5]);
    e.push_back(v[1]);
    REP(i,6) v[i] = e[i];
}

void Dice::north() {
    vector<int> e;
    e.push_back(v[1]);
    e.push_back(v[5]);
    e.push_back(v[2]);
    e.push_back(v[3]);
    e.push_back(v[0]);
    e.push_back(v[4]);
    REP(i,6) v[i] = e[i];
}

void Dice::west() {
    vector<int> e;
    e.push_back(v[2]);
    e.push_back(v[1]);
    e.push_back(v[5]);
    e.push_back(v[0]);
    e.push_back(v[4]);
    e.push_back(v[3]);
    REP(i,6) v[i] = e[i];
}

void Dice::random() {
    random_device rnd;
    switch (rnd() % 4) {
        case 0:
            west();
            break;
            
        case 1:
            north();
            break;
            
        case 2:
            south();
            break;
            
        case 3:
            east();
            break;
            
        default:
            break;
    }
}

vector<int> Dice::getContents() {
    return v;
}

bool sameDice(Dice dice, Dice dice2) {
    REP(i,10000) {
        dice.random();
        bool okay = true;
        REP(j,6) {
            okay *= dice.getContents()[j] == dice2.getContents()[j];
        }
        if (okay) return true;
    }
    return false;
}

int main() {
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    Dice dice(a,b,c,d,e,f);
    cin >> a >> b >> c >> d >> e >> f;
    Dice dice2(a,b,c,d,e,f);
    if (sameDice(dice, dice2)) {
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
  vector<int> a(n);
  for(int i=0;i<n; i++){
  cin>>a[i];
  }
  for(int i=n-1;i>0;i--){
  if((a[i-1]-a[i])>=2){
    cout<<"No";
    return 0;
  }
    else if((a[i-1]-a[i])==1){
    a[i-1]--;
    }
    else {
    continue;}
  }
  cout<<"Yes"<<endl;
return 0;
}

Measured memory_bytes: 640
/**
 *    author        : Saurav Paul 
 *    created       : August 24, 2020 11:31 AM
 *    Problem Name  : B - Multiple of 9
 *    Problem Limit : 2000 ms , 1024 MB
 *    Problem Url   : https://atcoder.jp/contests/abc176/tasks/abc176_b
 *    @genarated by : ai-virtual-assistant
**/

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

using ll = long long int ;

void solve(){

    string N ;
    cin >> N ;
    ll sum = 0 ;
    for(auto x : N) sum += x-'0' ;
    cout <<(sum%9 == 0?"Yes": "No") << endl ;
}

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

    int testcases = 1;
    for(int i = 1 ; i <= testcases ; i ++){
        solve();
    }

    return 0 ;
}


Measured memory_bytes: 3772
/// Bismillahir Rahmanir Rahim
/* Mohammad Morsalin
   Dept of ICE, NSTU
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define int long long
#define f0(n) for(int i=0;i<n;i++)
#define ms(x) memset(x,0,sizeof(x))
#define ms2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pi pair<int,int>
#define tc(t) int t;cin>>t;while(t--)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ins insert
#define ALL(v) v.begin(),v.end()
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define fi first
#define se second
#define PI acos(-1)
#define sz(a) (int)a.size();
#define IOS ios::sync_with_stdio(false);
using namespace std;
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const long long MOD = 1000000007;
double sq(double x) {return x*x;}
template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
signed main()
{
    IOS
    int n;
    cin>>n;
    vector<int>vec(n);
    for(int i=0;i<n;i++){
        cin>>vec[i];
    }
    map<int,int>mmp;
    bool pd=0;
    for(int i=0;i<n;i++){
        int v=vec[i];
        for(int j=2;j*j<=v;j++){
            int gun=0;
            while(v%j==0) {
                gun++;
                v/=j;
            }
            if(gun){
                if(mmp[j]){
                    pd=1;
                }
                else mmp[j]=1;
            }

        }
        if(v>1){
            if(mmp[v]){
                pd=1;
            }
            else mmp[v]=1;
        }
    }
    if(!pd){
        cout << "pairwise coprime\n";
    }
    else{
        int gc=vec[0];
        for(int i=1;i<n;i++){
            gc=gcd(gc,vec[i]);
        }
        if(gc==1){
            cout << "setwise coprime\n";
        }
        else{
            cout << "not coprime\n";
        }
    }

    return 0;
}
///Alhamdulillah


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

int a,k[1000],ans,sum;

bool cmp(int a,int b){
	return a>b;
}

int main(){
	scanf("%d",&a);
	for(int i=1;i<=a;i++){
		scanf("%d",&k[i]);
	}
	sort(k+1,k+1+a,cmp);
	for(int i=1;i<=a;i+=2){
		ans+=k[i];
	}
	for(int i=2;i<=a;i+=2){
		sum+=k[i];
	}
	printf("%d\n",abs(ans-sum));
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  map<char,bool> mp;
  for(int i=0; i<S.size(); i++){
    if(mp.count(S.at(i))){
      continue;
    }
    else{
      mp[S.at(i)] = true;
    }
  }
  
  int ans = 1000;
  if(S.size() == 1){
    ans = 0;
  }
  else{
   for(auto itr = mp.begin(); itr != mp.end(); itr++){
    char x = itr->first;
    string s = S;
    bool exist = false;
    int cnt = 0;
    
    while(!exist){
      cnt++;
       for(int i=0; i<s.size()-1; i++){
        if(s.at(i) == x || s.at(i+1) == x){
         s.at(i) = x;
        }
       }
       s.pop_back();
       for(int i=0; i<s.size(); i++){
         if(s.at(i) != x){
          break;
         }
         if(i == s.size()-1){
          exist = true;
         }
        }
     }
    ans = min(ans,cnt);
  }
  
  bool origin = false;
  for(int i=0; i<S.size()-1; i++){
    if(S.at(i) != S.at(i+1)){
      break;
    }
    if(i == S.size()-2){
      origin = true;
    }
  }
  
   if(origin){
    ans = 0;
   }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
 
int main(){
    int n;
    in(n);
    vector<int> vec(n);
    uset<int> kind;
    umap<int,int> memo;
    rep(i,n){
        in(vec[i]);
        if(kind.count(vec[i])){
            memo[vec[i]]++;
        }else{
            kind.insert(vec[i]);
            memo[vec[i]]=1;
        }
    }
    if(kind.size()>=4){
        out("No");
    }else if(kind.size()==3){
        vector<int> vec(3);
        int i=0;
        for(auto value:kind){
            vec[i]=value;
            i++;
        }
        bitset<32> abit(vec[0]),bbit(vec[1]),cbit(vec[2]);
        abit=(abit^bbit);
        abit=(abit^cbit);
        yn(abit.to_ullong()==0&&memo[vec[0]]==memo[vec[1]]
        &&memo[vec[1]]==memo[vec[2]]);
    }else if(kind.size()==2){
        vector<int> vec(2);
        int i=0;
        for(auto value:kind){
            vec[i]=value;
            i++;
        }
        sort(all(vec));
        yn(vec[0]==0&&2*memo[vec[0]]==memo[vec[1]]);
    }else{
        yn(*begin(kind)==0);
    }
}

Measured memory_bytes: 10120
import sys
import math
def ReplaceElements(arr, n): 
  
    X = 0
  
    # Calculate the xor of all the elements 
    for i in range(n): 
        X ^= arr[i] 
  
    # Replace every element by the 
    # xor of all other elements 
    for i in range(n): 
        arr[i] = X ^ arr[i]
n=int(input())
a=list(map(int,input().split()))
ReplaceElements(a,n)
print(*a)

Measured memory_bytes: 97184
import sys
readline = sys.stdin.readline

def solve():
    N = int(readline())
    A = list(map(int, readline().split()))
    Q = int(readline())
    BC = [list(map(int, readline().split())) for i in range(Q)]

    count = {}
    for a in A:
        count[a] = count.get(a, 0) + 1
    
    s = sum(A)

    for b, c in BC:
        if b in count:
            nb = count[b]
            diff = (c - b) * nb
            s += diff
            print(s)

            del count[b]
            count[c] = count.get(c, 0) + nb
        else:
            print(s)


solve()

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

int main() {
	string s;
	cin >> s;
	set<string> st;
	for(int i=0;i<s.size();++i) {
		string sub = s.substr(i,1);
		st.insert(sub);
	}
	if (st.size()==s.size()){
		cout << "yes" << endl;
	} else {
		cout << "no" << endl;
	}
	return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N,H,W;

signed main(){
    cin>>N>>H>>W;
    int cnt=0;
    while(N--){
        int a,b;
        cin>>a>>b;
        if(a>=H&&b>=W)cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <string.h>
#include <iostream>
using namespace std;
int main()
{
    // 文字列の入力
    string str;
    cin >> str;
    int k = 15;
    int l = 0;
    char ch[1] = "";
    for(int i = 0; i < (int)str.size(); ++i){
        ch[0] = str[i];
        if (strcmp(ch, "x") == 0) {  
          l++;
        }
    }

    if (l > 7) { 
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
using ll=long long int;

int main() {
    ll n, k;
    cin >> n >> k;
    vector<pair<int, int>> sushi(n);
    for (auto &e: sushi) cin >> e.first >> e.second;

    sort(sushi.begin(), sushi.end(), greater<>());
    vector<ll> kt, other;
    kt.push_back(sushi[0].second);
    for (int i = 1; i < n; ++i) {
        if (sushi[i].first != sushi[i-1].first) {
            kt.push_back(sushi[i].second);
        } else {
            other.push_back(sushi[i].second);
        }
    }
    sort(kt.begin(), kt.end(), greater<>());
    sort(other.begin(), other.end(), greater<>());

    ll kcnt = min(k, (ll)kt.size());
    ll p = accumulate(kt.begin(), kt.begin() + kcnt, 0LL);
    p += accumulate(other.begin(), other.begin() + (k - kcnt), 0LL);
    ll ans = p + kcnt * kcnt;
    --kcnt;
    for (; kcnt > 0 && k - kcnt <= other.size(); --kcnt) {
        p -= kt[kcnt];
        p += other[k - kcnt - 1];
        ans = max(ans, p + kcnt * kcnt);
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 2168
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    int iFactorial[8];
    iFactorial[0] = 1;
    iFactorial[1] = 1;
    iFactorial[2] = 2;
    iFactorial[3] = 6;
    iFactorial[4] = 24;
    iFactorial[5] = 120;
    iFactorial[6] = 720;
    iFactorial[7] = 5040;
  
    int a[n],b[n];
    int naCount = 0;
    int nbCount = 0;
    for(int i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }
    for(int i = 0; i < n - 1; i++){
        naCount += (a[i] - 1) * iFactorial[n - 1 - i];
        for(int j = i + 1; j < n; j++){
            if(a[i] < a[j]){
                a[j]--;
            }
        }
    }
    
    for(int i = 0; i < n; i++){
        scanf("%d", &b[i]);
    }
    for(int i = 0; i < n - 1; i++){
        nbCount += (b[i] - 1) * iFactorial[n - 1 - i];
        for(int j = i + 1; j < n; j++){
            if(b[i] < b[j]){
                b[j]--;
            }
        }
    }
    printf("%d\n", abs(naCount - nbCount));
    
    return 0;
}


Measured memory_bytes: 3224
#include<bits/stdc++.h>
using namespace std;
long long a[100000];
int main(){
	int n,k,q;
	cin >> n >> k >> q;
	if(q<k){
		for(int i=0;i<n;i++){
			cout << "Yes" << endl;
		}
		return 0;
	}
	for(int i=0;i<q;i++){
		int t;
		cin >> t;
		a[t-1]++;
	}
	for(int i=0;i<n;i++){
		if(a[i]>q-k){
			cout << "Yes" << endl;
		}
		else
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include <stdio.h>
#include<algorithm>
#include<string.h>
#include<cmath>
#include <vector>
using namespace std;
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    int p=a+b,q=a-b,r=a*b;
    printf("%d",max(p,max(q,r)));
}




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

const int N = 800228;
int a[N];
int s[N];

int lc[N];
int rc[N];

set<int> ss;

int n, m;
void dfs(int v) {
    v %= n;
    ss.erase(v);
    ss.erase(v + n);

    for (;;) {
        auto it = ss.lower_bound(lc[v]);
        if (it != ss.end() && *it < rc[v]) {
            dfs(*it % n);
        } else {
            break;
        }
    }
}

int main() {
#ifdef BZ
    freopen("input.txt", "r", stdin);
#endif  
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout.setf(ios::fixed); cout.precision(20);
 
    cin >> n >> m;
    n *= 2;

    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a, a + n);


    for (int i = 0; i < n; ++i) {
        a[n + i] = a[i] + m;
    }

    int l = 0, r = m;


    while (l +1 <r) {
        int md = (l + r) / 2;

        memset(s, 0, sizeof(s));

        /*for (int i = 0; i < 2 * n; ++i) {
            ss.insert(i);
        }*/

        for (int i = 0; i < n; ++i) {
            lc[i] = lower_bound(a, a + 2 * n, m - a[i]) - a;
            rc[i] = lower_bound(a, a + 2 * n, m - a[i] + md) - a;
            ++s[lc[i] + i];
            --s[rc[i] + i];
        }

        bool bad = false;

        /*for (int i = 0; i < n; ++i) {
            if (ss.count(i)) {
                dfs(i);

                bad |= (ss.size() / 2) % 2;
            }
        }*/

        bool good = false;
        for (int i = 0; i < 3 * n; ++i) {
            s[i + 1] += s[i];
        }

        for (int i= 0; i < n; ++i) {
            good |= (i %2) && (s[i] + s[i + n] + s[i + 2 * n] == n);
        }

        ((good && !bad) ? r : l) = md;
    }

    cout << l << "\n";
}

Measured memory_bytes: 9216
a, b, k = map(int, input().split(' '))

if a > 0 and k >= a:
	k -= a
	a = 0
elif a > 0:
	a -= k
	k = 0

if b > 0 and k >= b:
	k -= b
	b = 0
elif b > 0:
	b -= k
	k = 0

print(a, b)

Measured memory_bytes: 3060
#include <stdio.h>

int main( void ) {

	int n, stack[1000], i = 0;

	while (	scanf( "%d", &n ) != EOF ) {

		if ( n == 0 ) {

			i--;
			printf( "%d\n", stack[i] );

		} else {
			
			stack[i] = n;
			i++;
			
		}

	}

	return 0;

}

Measured memory_bytes: 604
#include <algorithm>
#include <queue>
#include <cstdio>
#include <iostream>
using namespace std;
int a[100005];
int main(){
    int n;
    scanf("%d",&n);
    for (int i=0; i<n; i++) {
        cin>>a[i];
    }
    sort(a,a+n);
    queue<int>b;
    for (int i=n; i>0; i--) {
        if (a[i]==a[i-1]) {
            b.push(a[i]);
            b.push(a[i-1]);
            i--;
        }
    }
    int k=0;
    long long ans=1;
    int m=4;
    if(k<2&&b.size()>=m) {
        ans=ans*b.front();
        b.pop();
        b.pop();
        m=m-2;
        int w=b.front();
        b.pop();
        if (w==b.front()) {
            ans=ans*w;
            k++;
        }
        k++;
    }
    if (k<2) {
        cout<<0;
    }
    else cout<<ans;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
const int inf=0x3f3f3f3f;
#define endl '\n'

int n,a[N],sq[N],cnt,start,t;
ll k;

int main(){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		sq[i]=-1;
	}
	cnt=-1;
	for(int i=1;;){
		cnt++;
		if(cnt==k) {
			cout<<i<<endl;
			return 0;
		}
		if(sq[i]==-1) {
			sq[i]=cnt;
			i=a[i];
		}
		else {
			t=cnt-sq[i];
			if(i==1){
				start=a[1];
				k=(k-1)%t;
			}
			else {
				start=i;
				k=(k-sq[i])%t;
			}
			break;
		}
	}
	cnt=-1;
	for(int i=start;;i=a[i]){
		cnt++;
		if(cnt==k) {
			cout<<i<<endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 5208
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <cstring>
//#define LOCAL
using namespace std;
typedef long long ll;
const int mx=1e5+10;
ll a[mx];

void display(ll n, ll num[mx]){
    for(ll i=0;i<n;i++){
        if(0==i) printf("%lld", num[i]);
        else printf(" %lld", num[i]);
    }
    puts("");
}

int main() {
#ifdef LOCAL
ifstream fin("1.txt");
streambuf*p;
p=cin.rdbuf(fin.rdbuf());
#endif // LOCAL
ll n;
cin>>n;
for(ll i=0;i<n;i++) cin>>a[i];
ll b[mx], c[mx];
memcpy(b, a, sizeof(a)), memcpy(c, a, sizeof(a));
if(prev_permutation(b, b+n)) display(n, b);
display(n, a);
if(next_permutation(c, c+n)) display(n, c);




#ifdef LOCAL
fin.close();
#endif // LOCAL
}




Measured memory_bytes: 4840
/*  ex3_3
    potter0723sw  */

//方針：NをKで何回も割って商が0になるまでの割る回数をカウントする

#include <stdio.h>

int main(void) {
	int N,K,answer;
	scanf("%d %d", &N, &K);
	answer = 1;//最後に2桁増えることを考慮して1からスタート
	while(N >= K){//NがKより小さくなったら割るのを終わる
		N = N / K;
		answer += 1;
	}
	printf("%d\n",answer);
	return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=1000;
struct node {
	int t,x,y;
};
int T(int x) {
	return x>-x?x:-x;
}
int  n;
node last,now;
int main()
{
	bool sign=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		scanf("%d%d%d",&now.t,&now.x,&now.y);
		if(T(now.t-last.t)%2!=(T(now.x-last.x)+T(now.y-last.y))%2||T(now.x-last.x)+T(now.y-last.y)>T(now.t-last.t))
			sign=1;
		last=now;
	}
	if(sign) printf("No");
	else printf("Yes");
}

Measured memory_bytes: 128
LI = lambda: list(map(int,input().split()))
MI = lambda: map(int,input().split())
yes = lambda: print("YES")
no = lambda: print("NO")
I = lambda: list(input())
J = lambda x: "".join(x)
II = lambda: int(input())
SI = lambda: input()
#---khan17---template
n = II()
l = []
for i in range(n):
	l.append(SI())
print(len(set(l)))

Measured memory_bytes: 35516
s = list(input())
ans = 0

for i in range(1, len(s)):
    if s[i-1] == s[i] and s[i-1] == "0":
        ans += 1
        s[i] = "1"
    if s[i-1] == s[i] and s[i-1] == "1":
        ans += 1
        s[i] = "0"
print(ans)

Measured memory_bytes: 3956
N=int(input())
#b,c=int(input()),int(input())
# c=[]
#  for i in b:
#     c.append(i)
#e1,e2 = map(int,input().split())
A = list(map(int,input().split()))
#j = [input() for _ in range(a)]
# h = []
# for i in range(e1):
#     h.append(list(map(int,input().split())))
A.sort()
ans="YES"
for i in range(1,N):
    if A[i-1]==A[i]:
        ans="NO"
        break
print(ans)

Measured memory_bytes: 103964
#include<iostream>
using namespace std;
constexpr int f(int a){
	return a?a%10+f(a/10):0;
}
template<int N>struct ans{
	int a[37][N+1];
	constexpr ans(){
		for(int i=1;i<=N;i++){
			for(int j=1;j<=36;j++)a[j][i]=a[j][i-1];
			a[f(i)][i]+=i;
		}
	}
};
template<int N>struct test{
	int ary[N];
	constexpr test():ary(){
		for(int i=0;i<N;i++)ary[i]=f(i);
	}
};
ans<10000>s;
main(){
	int ans=0,n,a,b;
	cin>>n>>a>>b;
	for(int i=a;i<=b;i++)ans+=s.a[i][n];
	cout<<ans<<endl;
}


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

using namespace std;

typedef long long ll;
typedef pair< ll, ll > pll;

const double pi = 3.14159265358979323846;

#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second
#define VL vector< ll >

// -----------------------------------------------------------------------------
// main
// -----------------------------------------------------------------------------
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll N;
  cin >> N;

  string s[N];
  cin >> s[0];

  for (int i = 1; i < N; i++) {
    cin >> s[i];

    if (s[i - 1].back() != s[i].front()) {
      cout << "No" << endl;
      return 0;
    }

    for (int j = 0; j < i; j++) {
      if (s[i] == s[j]) {
        cout << "No" << endl;
        return 0;
      }
    }
  }

  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int dp[110][100010];


signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, W;
    cin >> N >> W;
    int w[110], v[110];
    rep(i, N) {
        cin >> w[i] >> v[i];
    }
    rep(i, 110) rep(j, 100010) dp[i][j] = INF2;
    dp[0][0] = 0;
    rep(i, N) {
        REP(j, 0, 100010) {
            dp[i + 1][j] = dp[i][j];
            if (j - v[i] >= 0)
                dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - v[i]] + w[i]);
        }
    }
    int ans = 0;
    /*
    rep(i, N + 1) {
        rep(j, 20) {
            cout << i << " " << j << " " << dp[i][j] << endl;
        }
    }
    */
    rep(i, 100010) if (dp[N][i] <= W) ans = max(ans, i);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 86272
#include<bits/stdc++.h>
using namespace std;
 int main()
 {
   map<int ,int> m;
   int n,i;
   cin>>n;
   for(i=0;i<n-1;i++)
   {
       int x;
       cin>>x;
       m[x]++;
   }
   for(i=1;i<=n;i++) cout<<m[i]<<"\n";
   return 0;
 }

Measured memory_bytes: 12960
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(void)
{
    long long int div = 1000000007;
    long long int n;
    cin >>n;


    long long int dp[4][4][4][110];

    for(int i = 0; i < 4; i++){
        for(int j = 0; j < 4; j++){
            for(int z = 0; z < 4; z++){
                for(int k = 0; k <= n; k++){
                    if(k == 3){
                        dp[i][j][z][k] = 1;
                    }else{
                        dp[i][j][z][k] = 0;
                    }
                }
            }
        }
    }

    dp[0][2][1][3] = 0;
    dp[2][0][1][3] = 0;
    dp[0][1][2][3] = 0;

    for(int k = 4; k <= n; k++){
        for(int i = 0; i < 4; i++){
            for(int j = 0; j < 4; j++){
                for(int z = 0; z < 4; z++){
                    for(int now = 0; now < 4; now++){
                        if(
                            (j==0&&z==2&&now==1)||
                            (j==2&&z==0&&now==1)||
                            (j==0&&z==1&&now==2)||
                            (i==0&&z==2&&now==1)||
                            (i==0&&j==2&&now==1)
                        ){
                            continue;
                        }
                        dp[j][z][now][k] = (dp[j][z][now][k] + dp[i][j][z][k-1]) % div;
                    }
                }
            }
        }
    }

    long long int ans = 0;
    for(int i = 0; i < 4; i++){
        for(int j = 0; j < 4; j++){
            for(int z = 0; z < 4; z++){
                ans = (ans + dp[i][j][z][n]) % div;
            }
        }
    }
    printf("%lld\n", ans);

    return 0;
}

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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    int N; cin >> N;
    if (N != 1) {
        int A, B; cin >> A >> B;
        cout << A + B << endl;
    }
    else cout << "Hello World" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main(){
    int n;
    cin>>n;
    
    ll ans=0;
    ll now=0;
    rep(i,0,n){
        ll a;
        cin>>a;
        if(a==0){
            ans+=now/2;
            now=0;
        }
        else{
            now+=a;
        }
        if(i==n-1) ans+=now/2;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


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

		int[] value = new int[10];
		int x = 512;
		List<Integer> v = new ArrayList<Integer>();
		for(int i=0;i<10;i++){
			value[i] = x;
			x /= 2;
		}

		while(sc.hasNext()){
			int w = sc.nextInt();
			v.clear();
			for(int i=0;i<10;i++){
				if(value[i] <= w){
					w -= value[i];
					v.add(value[i]);
				}
			}
			for(int i=v.size()-1; i >= 0 ; i--){
				if(i == 0) {
					System.out.println(v.get(i));
				}else{
					System.out.print(v.get(i) + " ");
				}
			}
		}
	}
}

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

int main(){
  int flag = 1;
  string S;
  cin >> S;
  for(int i=0; i<S.size(); i++){
    if((i+1)%2 == 0){
      if(S[i] != 'L' && S[i] != 'U' && S[i] != 'D'){ flag = 0;}
    }else{
      if(S[i] != 'R' && S[i] != 'U' && S[i] != 'D'){ flag = 0; }
    }
  }
  if(flag){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


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

// to increase precision
// std::cout<<std::fixed;
// 	std::cout<<std::setprecision(6)<<z;
//clock_t tStart = clock();
//printf("Time taken: %.9fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
#define maxn 100007

#define ll long long int

ll mod=998244353;
int main(){
	int n;
	cin>>n;
	string ans[4]={"AC","WA","TLE","RE"};
	map<string,int> mp;
	for(int i=0;i<n;i++){
		string temp;
		cin>>temp;
		mp[temp]++;
	}
	for(int i=0;i<4;i++){
		cout<<ans[i]<<" "<<"x "<<mp[ans[i]]<<endl;
	}

}

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

int main() {
    int N;
    int a[110];  // 最大 100 個ですが余裕をもたせます
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> a[i];

    sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート
    int Alice = 0;
    int Bob = 0;
    for (int i = 0; i < N; ++i) {
        if (i % 2 == 0) { // Alice のターン
            Alice += a[i];
        }
        else { // Bob のターン
            Bob += a[i];
        }
    }
    cout << Alice - Bob << endl;
}

Measured memory_bytes: 632
t,l,b,a,I,J,s;main(n){while(scanf("%d%d%d%d",&n,&t,&l,&b),n){float d[101][101]={{}},o=0;int f[101]={};while(b+l--)scanf("%d",&a),f[a]=l>=0?1:2;d[0][0]=1;for(l=0;l<=t;l++){o+=d[l][n];d[l][n]=0;for(b=0;b<=n;b++){I=l+(f[b]-1?1:2);if(I<=t)for(s=1;s<7;s++){J=b+s;if(J>n)J=2*n-J;J=f[J]-2?J:0;d[I][J]+=d[l][b]/6;}}}printf("%f\n",o);}}

Measured memory_bytes: 1804
#include<iostream>
using namespace std;
int main(){
	int n,a,b,sum=0;
	cin >> n >> a >> b;
	for(int i=1;i<=n;i++){
		int dig=0,x=i;
		while(x){
			dig+=x%10;
			x/=10;
		}
		if(dig>=a&&dig<=b){
			sum+=i;
		}
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 256
A, B = map(int, input().split())
S = input()
f = True
for i in range(len(S)):
  if i < A:
    if S[i] == '-':
      f = False
      break
  if i == A:
    if S[i] != '-':
      f = False
      break
  else:
    if S[i] == '-':
      f = False
      break
if f:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 3060
// Ryo Kamoi
// #define DEBUG

#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>

using namespace std;

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

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

int INF = 1000000000;

struct edge {
    int cost; int to;
};

int n, m, c, start, goal;
int dist[30][100][100];
int cost[100][100];
int p[30];
int q[30][60], r[30][60];
int dist_cost[30][10010];

int calc_cost(int com, int dist) {
    int output = 0;
    REP(i, p[com]-1) {
        if (dist > q[com][i+1]) {
            output += r[com][i] * (q[com][i+1]-q[com][i]);
        } else {
            output += r[com][i] * (dist-q[com][i]);
            return output;
        }
    }
    output += r[com][p[com]-1] * (dist-q[com][p[com]-1]);
    return output;
}

int main(){
    while(1) {
        cin >> n >> m >> c >> start >> goal;
        if (n==0) break;

        REP(i, c) {
            REP(j, n) {
                REP(k, n) {
                    dist[i][j][k] = INF;
                    if (j==k) {
                        dist[i][j][k] = 0;
                    }
                }
            }
        }

        // distance
        REP(i, m) {
            int x, y, di, ci;
            cin >> x >> y >> di >> ci;
            dist[ci-1][x-1][y-1] = min(dist[ci-1][x-1][y-1], di);
            dist[ci-1][y-1][x-1] = min(dist[ci-1][y-1][x-1], di);
        }

        // cost
        REP(i, c) {
            cin >> p[i];
        }

        REP(com, c) {
            q[com][0] = 0;
            REP(i, p[com]-1) {
                cin >> q[com][i+1];
            }
            REP(i, p[com]) {
                cin >> r[com][i];
            }
        }

        // min dist for each company
        REP(com, c) {
            REP(k, n) {
                REP(i, n) {
                    REP(j, n) {
                        dist[com][i][j] = min(dist[com][i][j],
                                dist[com][i][k] + dist[com][k][j]);
                    }
                }
            }
        }

        // calculate cost
        REP(i, n) {
            REP(j, n) {
                cost[i][j] = INF;
                if (i==j) {
                    cost[i][j] = 0;
                }
            }
        }

        REP(com, c) {
            REP(i, n) {
                REP(j, n) {
                    if (dist[com][i][j] < INF) {
                        cost[i][j] = min(cost[i][j],
                                calc_cost(com, dist[com][i][j]));
                    }
                }
            }
        }

#ifdef DEBUG
        REP(i, 15) {
            cout << calc_cost(0, i) << " ";
        }
        cout << endl;
        cout << calc_cost(0, 100000) << endl;
#endif

        REP(k, n) {
            REP(i, n) {
                REP(j, n) {
                    cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
                }
            }
        }

        if (cost[start-1][goal-1] < INF) {
            cout << cost[start-1][goal-1] << endl;
        } else {
            cout << -1 << endl;
        }
    }
}



Measured memory_bytes: 3968