akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>


using namespace std;

int main(){
    int A,B;
    cin >> A >> B;
    if((A+B)%2==0){
        cout << (A+B)/2 << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }

}

Measured memory_bytes: 256
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define F first
#define S second
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())
#define vout(v) for (auto z: v) cout << z << " "; cout << endl;

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;
ll vis[N],res[N];

int solve() 
{
	//happy coding

	string s;
	cin>>s;

	if(s[2]==s[3]&&s[4]==s[5]){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}

	
	return 0;
}
int main(){
	int test = 1;
	//scanf("%d", &test);
	while (test--)solve();return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	long long int a;
	
	scanf("%lld", &a);
	
	long long int tot = 0;
	
	for(int i = 1; i <= a; i++) {
		if(i%3 == 0) {
			tot += 0;
		}
		else if(i%5 == 0) {
			tot += 0;
		}
		else{
			tot += i;
		}
	}
	
	printf("%lld\n", tot);
	
	return 0;
}


Measured memory_bytes: 1696
#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;
    string s;
    string t;

    cin >> s;
    cin >> t;

    string ans = s + t;

    int j = -1;
    rep(i, n){
        j++;
        ans.at(j) = s.at(i);
        j++;
        ans[j] = t.at(i);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int fish[1000000];

int main(void) {
	int n,q,a,v,i,j,maxa,maxv;
	
	scanf("%d %d",&n,&q);
	
	maxa = n+1;
	maxv = 0;
	for(i = 0;i < q;i++){
		scanf("%d %d",&a,&v);
		fish[a-1] += v;
		
		if(v>0){
			if((maxv < fish[a-1]) || ((maxv == fish[a-1]) && (maxa > a))){
				maxa = a;
				maxv = fish[a-1];
			}
		}else{
			if(maxa == a){
				maxa = n+1;
				maxv = 0;
				for(j = 0;j < n;j++){
					if((maxv < fish[j]) || ((maxv == fish[j]) && (maxa > a))){
						maxa = j+1;
						maxv = fish[j];
					}
				}
			}
		}
		printf("%d %d\n",maxa,maxv);
	}
	
	return 0;
}

Measured memory_bytes: 4500
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;

class Main {

    private static final int MOUNTAIN_COUNT = 10;

    public static void main(final String[] args) throws IOException, NumberFormatException {

        Integer[] mountainHeights = new Integer[10];

        BufferedReader input = null;
        try {
            input = new BufferedReader(new InputStreamReader(System.in));
            for (int i = 0; i < MOUNTAIN_COUNT; i++) {
                mountainHeights[i] = Integer.parseInt(input.readLine());
            }
        } finally {
            if (input != null) {
                input.close();
            }
        }

        Arrays.sort(mountainHeights, new Comparator<Integer>() {
            @Override
            public int compare(final Integer lhs, final Integer rhs) {
                return rhs.compareTo(lhs);
            }
        });

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

}

Measured memory_bytes: 16892
my ($P,$Q,$R) = split(/ /, <>);

my $ABC = $P+$Q;
my $ACB = $Q+$R;
my $BCA = $P+$R;

my $min = $ABC;
$min = $ACB if ($min > $ACB);
$min = $BCA if ($min > $BCA);

print($min);

Measured memory_bytes: 512
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        for(int i=1; i<=n; i++) {
            int a = sc.nextInt();
            if(i % 2 == 1) {
                if(a % 2 == 1) {
                    ans++;
                }
            }
        }
        System.out.println(ans);
    }
}

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007
typedef long long ll;

int main() {
    int a,b;cin>>a>>b;

    if((a+b)%2!=0){

        cout<<"IMPOSSIBLE"<<endl;
        return 0;
    }
    cout<<(a+b)/2<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fo(i,s,e) for( i=s;i<e;i++)
#define rfo(i,s,e) for(i=s;i>e;i--)
#define LLI long long int
#define LI long int 
const LI MOD=1e9+7;
#define pb push_back
#define pob pop_back()
#define sp " "
#define ff first
#define ss second
//            When something is important enough, you do it even if the odds are not in your favor.
LI cnt[(LI)1e5+4];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    // code goes here
    int t=1;//cin>>t;
    while(t--){
      LI n,i;cin>>n;
      LI a[n];
      LLI sum=0;
      fo(i,0,n) {cin>>a[i];cnt[a[i]]++;sum+=a[i];}
      LI q;cin>>q;
      while(q--){
        LI b,c;cin>>b>>c;
        sum-=cnt[b]*b;sum+=cnt[b]*c;
        cnt[c]+=cnt[b];
        cnt[b]=0;
        cout<<sum<<endl;
      }
    }
    return 0;
}

Measured memory_bytes: 5236
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
#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 rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    cin >> N >> M;
    cout << N*(N-1)/2+M*(M-1)/2 << endl;
    
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
    int n;cin>>n;
    vi l(n),r(n);
    rep(i,n)cin>>l[i]>>r[i];
    vector<bool>b(100005);
    rep(i,100005)b[i]=false;
    for(int i=3;i<=100000;++i){
        int m=i,k=(i+1)/2;
        for(int j=2;j*j<=m;++j){
            while(m%j==0){
                m/=j;
            }
            
        }
        for(int j=2;j*j<=k;++j){
            while(k%j==0){
                k/=j;
            }
        }
        if(i==m&&(i+1)/2==k)b[i]=true;
    }
    int sum[100005];
    mem(sum,0);
    for(int i=1;i<=100000;++i){
        if(b[i])sum[i]=sum[i-1]+1;
        else sum[i]=sum[i-1];
    }
    rep(i,n){
        cout<<sum[r[i]]-sum[l[i]-1]<<endl;
    }
}


Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <climits>
#include <iostream>
#include <string>
#include <vector>

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define dprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define dprintf(...) 0
#endif

using namespace std;


int main() {
  int a, b, t;
  cin >> a >> b >> t;
  cout << t / a * b << '\n';

  return 0;
}


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

int main(){
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	
	int ans = 0;
	while (a[0] % 2 == 0 && a[1] % 2 == 0 && a[2] % 2 == 0) {
		ans++;
		int tmp[3];
		for (int i = 0;i < 3;i++) {
			tmp[i] = a[i];
		}
		for (int i = 0;i < 3;i++) {
			a[i] = tmp[(i + 1) % 3] / 2 + tmp[(i + 2) % 3] / 2;
		}
		if (a[0] == a[1] && a[0] == a[2]) {
			cout << "-1" << endl;
			return 0;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
object Main extends App {
  var numAry = io.StdIn.readLine.split(' ').map { _.toInt }
  while (!(numAry(0) == 0 && numAry (1) == 0)) {
    println(numAry.sorted.mkString(" "))
    numAry = io.StdIn.readLine.split(' ').map { _.toInt }
  }
}

Measured memory_bytes: 47056
N = gets.to_i
A = gets.split.map(&:to_i).sort

counts = Array.new(A[-1] + 1, 0)

A.each do |x|
    counts[x] += 1
end

c = 0
counts.each_with_index do |count, i|
    next if count == 0
    c += 1 if count == 1
    i.step(A[-1] ,i) do |k|
        counts[k] = 0
    end
end
puts c


Measured memory_bytes: 38228
#include<stdio.h>
int main(void){
  int hp,l,i;
  scanf("%d %d",&hp,&l);
  int at[l];
  for(i=0;i<l;i++){
    scanf("%d",&at[i]);
    hp-=at[i];
  }
  if(hp>0){
    printf("No");
  }else{
    printf("Yes");
  }
  return 0;
}

Measured memory_bytes: 512
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion
void Main();

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

bool f(string& S, int n){
    bool ret = true;
    REP(i, n){
        if(S[i] != S[i+n]){
            ret = false;break;
        }
    }
    return ret;
}

void Main(){
    int H, W;
    cin >> H >> W;
    vec<vec<char> > map(H+2, vec<char>(W+2, '0'));
    vec<P> bombs;
    FOR(i, H+1, 1){
        string S;
        cin >> S;
        FOR(j, W+1, 1){
            if(S[j-1] == '#'){
                bombs.push_back(make_pair(i, j));
                for(int k=-1; k<=1; k++){
                    for(int l=-1; l<=1; l++){
                        map[i+k][j+l]++;
                    }
                }
            }
        }
    }
    EACH(bomb, bombs){
        map[bomb.fi][bomb.se] = '#';
    }
    FOR(i, H+1, 1){
        FOR(j, W+1, 1){
            cout << map[i][j];
        }
        cout << el;
    }
}



Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;


int main()
{
	int n;
	cin>>n;
	vector<int>h(n);
	for(int i = 0; i < n; i++){
		cin>>h[i];
	}

	int ans = 0;
	bool flag = true;
	while(flag){
		flag = false;
		for(int i = 0; i < n; i++){
			if(h[i]==0)continue;
			else flag= true;
			if(i==n-1 || h[i+1]==0) ans++;
			h[i]--;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int dir[8][2] = { {-1,0}, {-1,1}, {0,1}, {1,1}, {1,0}, {1,-1}, {0,-1}, {-1,-1} };
const int maxn = 50;
char maps[maxn][maxn];
int m, n;
inline bool judge(int x, int y) {
    return !(x < 0 || x >= n || y < 0 || y >= m);
}

int main(void) {
    while(~scanf("%d%d", &n, &m)) {
        for(int i = 0; i < n; ++i) scanf("%s", maps[i]);
        for(int i = 0; i < n; ++i) {
            for(int j = 0; j < m; ++j) {
                if(maps[i][j] == '.') {
                    int cnt = 0;
                    for(int k = 0; k < 8; ++k) {
                        int tx = i + dir[k][0], ty = j + dir[k][1];
                        if(judge(tx, ty) && maps[tx][ty] == '#') ++cnt;
                    }
                    printf("%d", cnt);
                } else putchar('#');
            }
            puts("");
        }
    }
}

Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
const int N = 1e5+7,M = N * 2;
int edge[M],succ[M],ver[N],idx;
int h[N],n,m,d[N];
bool st[N];
void add(int u,int v)
{
	edge[idx] = v;
	succ[idx] = ver[u];
	ver[u] = idx++;
}
int main()
{
    memset(ver,-1,sizeof ver);
    scanf("%d%d",&n,&m);
    for(int i = 1;i <= n;++i)	scanf("%d",&h[i]);
    
    while(m--)
    {
    	int u,v;scanf("%d%d",&u,&v);
    	add(u,v),add(v,u);
    	d[u]++,d[v]++;
    }
    int res = 0;
   	for(int i = 1;i <= n;++i)
   	{
   		if(!d[i])	++res;
   		else
   		{
   			int ok = 1;
   			for(int _ = ver[i];~_;_ = succ[_])
   			{
   				int j = edge[_];
   				//cout << i << " " << j << endl;
   				if(h[j] >= h[i])
   				{
   					ok = 0;
   					break;
   				}
   			}
   			res += ok;
   		}
   	}
   	printf("%d",res);
   	
    return 0;
}


Measured memory_bytes: 6564
#include <bits/stdc++.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

int main() {
  int n;
  cin>>n;
  int h[n];
  int cur=0;
  for(int i=0;i<n;i++){
    cin>>h[i];
    bool ans=true;
    for(int j=0;j<i;j++){
      if(h[j]>h[i]) ans=false;
    }
    if(ans) cur++;
  }
  cout<<cur<<endl;
  return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vr vector
#define pb push_back


 int main()
 {
std::ios::sync_with_stdio(false); cin.tie(NULL);
//ll t;
//cin>>t;
//while(t--)
{

ll n,k=0;
cin>>n;
while(n)
{
    ll p=n%10;
    if(p==7)
        k=1;
    n/=10;
}
if(k==1)
    cout<<"Yes";
else
    cout<<"No";

   cout<<endl;

}
    return 0;
}





Measured memory_bytes: 3652
package main

import "fmt"

func main() {
	var A, B, r int
	fmt.Scan(&A, &B)
	if B == 1 {
		fmt.Println(0)
		return
	}
	w := B - A
	r++
	for w > 0 {
		w -= A - 1
		r++
	}
	fmt.Println(r)
}

Measured memory_bytes: 512
A,B,C = map(int,input().split())
L = [A,B,C]
t = 0
L.sort()
if L[0] == L[1] == L[2]:
  print(0)
else:
  for i in range(3):
    if L[i]%2 == 0:
      t += 1
  if t == 3 or t == 0:
    print((L[2]-L[0])//2+(L[2]-L[1])//2)
  elif t == 2:
    if L[0]%2 != 0:
      L[1] += 1
      L[2] += 1
      print(1+(L[2]-L[0])//2+(L[2]-L[1])//2)
    elif L[1]%2 != 0:
      L[0] += 1
      L[2] += 1
      print(1+(L[2]-L[0])//2+(L[2]-L[1])//2)
    else:
      L[0] += 1
      L[1] += 1
      print(1+(L[2]-L[0])//2+(L[2]-L[1])//2)
  else:
    if L[0]%2 == 0:
      L[1] += 1
      L[2] += 1
      print(1+(L[2]-L[0])//2+(L[2]-L[1])//2)
    elif L[1]%2 == 0:
      L[0] += 1
      L[2] += 1
      print(1+(L[2]-L[0])//2+(L[2]-L[1])//2)
    else:
      L[0] += 1
      L[1] += 1
      print(1+(L[2]-L[0])//2+(L[2]-L[1])//2)

Measured memory_bytes: 3188
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
#ifdef LOCAL
#define debug(x) cerr << #x << ": " << x << endl
#else
#define debug(x)
#endif
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

const ll INF = 1'000'000'000'000'000LL;

int N, M;
ll L;
ll dist[300][300];
int cost[300][300];

int Q;

signed main(){
	cin >> N >> M >> L;
	rep(i, N){
		rep(j, N){
			dist[i][j] = INF;
			if(i == j) dist[i][j] = 0;
		}
	}
	rep(i, M){
		int a, b, c;
		cin >> a >> b >> c;
		dist[a-1][b-1] = c;
		dist[b-1][a-1] = c;
	}

	rep(i, N){
		rep(j, N){
			rep(k, N){
				dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
			}
		}
	}

	rep(i, N){
		rep(j, N) cost[i][j] = INT_MAX;
		priority_queue<pair<int, int>> pq;
		rep(j, N){
			if(dist[i][j] <= L){
				cost[i][j] = 0;
				pq.push({ 0,j });
			}
		}
		while(!pq.empty()){
			int j = pq.top().second;
			pq.pop();
			rep(k, N){
				if(dist[j][k] <= L && cost[i][k] > cost[i][j]+1){
					cost[i][k] = cost[i][j]+1;
					pq.push({-cost[i][k], k});
				}
			}
		}
	}

	cin >> Q;
	rep(i, Q){
		int s, t;
		cin >> s >> t;
		s--; t--;
		if(cost[s][t] == INT_MAX) cout << -1 << endl;
		else cout << cost[s][t] << endl;
	}
}

Measured memory_bytes: 1536
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int n,m;
  int lot[30];
  cin >>n>>m;
  for(int i=0; i<n; i++)
    lot[i] = i+1;
  while(m--){
    int x,y,z;
    scanf("%d,%d",&x,&y);
    z = lot[x-1];
    lot[x-1] = lot[y-1];
    lot[y-1] = z;
  }
  for(int i=0; i<n; i++)
    cout <<lot[i]<<endl;
  return 0;
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] nk = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int[][] wv = new int[nk[0]][];
            for (int i = 0; i < nk[0]; i++)
            {
                wv[i] = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            }

            long[][] dp = new long[nk[0]+1][];
            dp = dp.Select(e => e = new long[100001]).ToArray();
            dp = dp.Select(e => e.Select(elem => elem = 0).ToArray()).ToArray();
            for (int i = 0; i < nk[0]; i++)
            {
                for (int sumW = 0; sumW <= nk[1]; sumW++)
                {
                    if (sumW -wv[i][0]>=0)
                    {
                        changeMax(ref dp[i + 1][sumW], dp[i][sumW - wv[i][0]]+wv[i][1]);
                    }
                    changeMax(ref dp[i + 1][sumW], dp[i][sumW]);
                }
            }
            Console.WriteLine(dp[nk[0]][nk[1]]);
        }

        static bool changeMax(ref long a, long b)
        {
            if (a < b)
            {
                a = b;
                return true;
            }
            return false;
        }
    }
}


Measured memory_bytes: 217792
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int n, m, a, b, count = 0;
	cin >> n >> m;
	vector<int> h(n);
	vector<vector<int>> road(n);
	vector<bool> goodi(n, true);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		road[a-1].push_back(b-1);
		road[b-1].push_back(a-1);
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < (int)road[i].size(); j++) {
			if (h[i] <= h[road[i][j]])
				goodi[i] = false;
		}
	}
	for (int i = 0; i < n; i++) {
		if (goodi[i] == true)
			count++;
	}
	cout << count;
}

Measured memory_bytes: 8712
package main

import "fmt"

func main() {
	var x int64
	fmt.Scanf("%d", &x)
	fx := getDigitSum(x)

	if x%fx == 0 {
		fmt.Printf("Yes")
	} else {
		fmt.Printf("No")
	}

}

func getDigitSum(n int64) int64 {
	var total int64
	for n > 0 {
		total += n % 10
		n /= 10
	}
	return total
}


Measured memory_bytes: 1832
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>

using namespace std;

#define lli long long int
#define REP(i,n) for(int i=0;i<n;i++)
#define INV(VECTOR,n) REP(i,n){\
	lli TMP;\
	cin>>TMP;\
	VECTOR.push_back(TMP);\
}

#define DEBUG 0

lli max(lli a,lli b){
	return a>=b ? a:b;
}

lli calc(lli a){
	lli sum=0;
	while(1){
		sum += a%10;
		a/=10;
		if(a==0)break;
	}
	return sum;
}


int main(){

	lli n;

	cin>>n;

	lli ans=1000000;
	for(int i=1;i<n;i++){
		if(ans >= (calc(i)+calc(n-i))){
			ans = (calc(i)+calc(n-i));
		}
	}
	cout<<ans<<endl;

	return 0;

}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <sstream>
#include <cctype>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
#define ms(a, b) memset(a, b, sizeof a)
int num[100005];
int g[200][200];
int cnt1, cnt2;
int main(){
    int h, w;
    scanf("%d%d", &h, &w);
    int n;
    scanf("%d", &n);
    for(int i = 1; i <= n; ++i)
        scanf("%d", &num[i]);
    int flag = 1;
    for(int i = 1; i <= h; ++i) {
        if(i % 2 == 1) {
            for(int j = 1; j <= w; ++j) {
                g[i][j] = flag;
                num[flag]--;
                if(num[flag] == 0)
                    flag++;
            }
        }
        else {
            for(int j = w; j >= 1; --j) {
                g[i][j] = flag;
                num[flag]--;
                if(num[flag] == 0)
                    flag++;
            }
        }
    }
    for(int i = 1; i <= h; ++i) {
        for(int j = 1; j <= w; ++j) {
            cout << g[i][j];
            if(j != w)
                cout << " ";
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 384
def argmin(x):
    xx = 1000
    ans = 0
    for i, xi in enumerate(x):
        if xi < xx:
            xx = xi
            ans = i
    return ans

def count_water(x, threshold):
    if len(x) == 1:
        return x[0] - threshold
    i = argmin(x)
    y = x[i] - threshold
    if i > 0:
        y += count_water(x[:i], x[i])
    if i < len(x) - 1:
        y += count_water(x[i + 1:], x[i])
    return y

n = int(input())
h = list(map(int, input().split()))
print(count_water(h, 0))

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

int n, t, x, y;

int main() {
	scanf("%d", &n);
	while (n--) {
		int tt, tx, ty;
		scanf("%d %d %d", &tt, &tx, &ty);
        if ((abs(tx - x) + abs(ty - y)) % 2 != (tt - t) % 2 || abs(tx - x) + abs(ty - y) > (tt - t)) {
            puts("No");
            return 0;
        }
        t = tt, x = tx, y = ty;
	}
	puts("Yes");
    return 0;
}

Measured memory_bytes: 256
n = input()
h = [int(i) for i in input().split()]

max = 0
i = 0
y = 1
for i in range(int(n)):
    if h[i] > max:
        max = h[i]
    elif h[i] < max-1:
        y = 0
    
if y==1:
    print("Yes")
else:
    print("No")

    

Measured memory_bytes: 14396
N = int(input())
A = list(map(int, input().split()))
s = 0
x = 0
while s == 0:
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] = A[i] // 2
        else:
            s += 1
    if s == 0:
        x += 1
print(x)

Measured memory_bytes: 38512
//BISMILLAHIR RAHMANIR RAHIM
#include <bits/stdc++.h>
#define mem(a, b) (memset(a, b, sizeof(a)))
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define INF 2147483647
#define MOD 1000000007
#define MAX 100005
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

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

    int a, b;

    cin>>a>>b;

    int ans = a / b;
    if(a % b != 0)
        ans++;

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int f[200009],a[200009];
main(){
    int n;
    cin>> n;
    for(int i =1; i <= n; i++){
        cin >> a[i];
    }
    int s  =0;
    if(n % 2 == 1){
        s = a[n];
    }
    else{
        s = 0;
        for(int i =1; i <= n; i++)
            s ^= a[i];
    }
    for(int i = 1; i <= n; i++)
        cout<<(s^a[i])<<" ";
    cout<<endl;
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  ll N,M;
  cin>>N>>M;
  ll ans=0;
  ans+=min(N,M/2);
  M-=ans*2;
  ans+=M/4;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N; cin >> N;
    vector<int> P(N); for (auto &p : P) cin >> p;
    int mi = 1e9;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        mi = min(mi, P[i]);
        if (mi >= P[i]) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
import itertools
N, M, Q = map(int, input().split())
P = list([int(j) for j in input().split()] for i in range(Q))

A = list(i for i in range(1, M+1))
X = list(itertools.combinations_with_replacement(A, N))
R = 0
T = 0
for x in X:
    for i in range(Q):
        if x[P[i][1]-1]-x[P[i][0]-1]==P[i][2]:
            R += P[i][3]
    T = max(T, R)
    R = 0
print(T)

Measured memory_bytes: 21540
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)


int32_t main(){
    int a;
  	cin >> a;
  int x = a*a;
  int y = x*a;
  cout << x + y + a << "\n";
    return 0;
}


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

vector <ll> forwardl;
vector <ll> backward;

int main()
{
	ll i,j,k,l,m = (1000000007),n,r;

	cin >> n >> k;

	// cout << n << '\n';

	forwardl.push_back(0);
	backward.push_back(0);

	for(i=0;i<=(n);i++)
	{
		forwardl.push_back(i+forwardl[i]);
		// cout << forwardl[i+1] << '\n';
	}

	for(i=(n);i>=0;i--)
	{
		backward.push_back(i+backward[n-i]);

		// cout << backward[n-i+1] << '\n';

	}

	ll t1 = 0,t2 =0;
	j = 0;

	for(i=k;i<=(n+1);i++)
	{
		j += (backward[i]-forwardl[i]+1);

		j = j%m;

		

	}

	cout << j%m << '\n';
}

Measured memory_bytes: 7968
#include <stdio.h>
 
int A,B;
 
int main() {
    scanf("%d %d", &A,&B);
    int i=A+B;
    int j=A-B;
    int k=A*B;
    
    if(i >= j ){
     if(i >= k){
         printf("%d", i);
         }else{
             printf("%d", k);
             }
       }
    else{
        if(j>=k){
            printf("%d", j);
            }else{
            printf("%d", k);
        }
    }
}

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

using namespace std;

using ll =  long long int;

#define int  long long int
#define mod  1000000007

ll mod_pow(ll a,ll b,ll m)
{
    ll res = 1;
    while(b)
    {
        if(b&1)
        {
            res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}

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

    int n;
    
    cin >> n;
    
    int a[n];
    int b[n];
    
    for(int i = 0; i < n; ++i) {
    	cin >> a[i];
    }
    
    multiset<int> st , st1 , s;
    
    for(int i = 0; i < n; ++i) {
    	cin >> b[i];
    	
    	st.insert(b[i]);
    	st1.insert(b[i]);
    	s.insert(b[i]);
    }
    
    int ans1[n];
    int f = 0;
    
	for(int i = 0; i < n; ++i) {
		auto u = st.end();
		u--;
		
		auto v = st.begin();
		
		if((*u) != a[i]) {
			ans1[i] = (*u);
			st.erase(u);
		}
		else if((*v) != a[i]) {
			ans1[i] = (*v);
			st.erase(v);
		}
		else {
			f = 1;
			break;
		}
	}
    
    if(f == 0) {
    	cout << "Yes\n";
    
	    for(int i = 0; i < n; ++i) {
	    	cout << ans1[i] << " ";
	    }
	    
	    return 0;
    }
    else {
    	f = 0;
    	int ans2[n];
    
		for(int i = 0; i < n; ++i) {
			auto u = st1.begin();
			
			auto v = st1.end();
			v--;
			
			if((*u) != a[i]) {
				ans2[i] = (*u);
				st1.erase(u);
			}
			else if((*v) != a[i]) {
				ans2[i] = (*v);
				st1.erase(v);
			}
			else {
				f = 1;
				break;
			}
		}
		
		if(f == 0) {
			cout << "Yes\n";
    
		    for(int i = 0; i < n; ++i) {
		    	cout << ans2[i] << " ";
		    }
		    
		    return 0;
		}
		else {
			f = 0;
			
			int ans3[n];
			
			for(int i = 0; i < n; ++i) {
				auto it=s.upper_bound(a[i]);
		        if(it!=s.end() && *it!=a[i]){
		            ans3[i]=*it;
		            s.erase(it);
		        }
		        else if(*(s.begin()) != a[i]){
		            ans3[i]=*(s.begin());
		            s.erase(s.begin());
		        }
		        else {
		        	cout << "No\n";
		        	return 0;
		        }
			}
			
			cout << "Yes\n";
    
		    for(int i = 0; i < n; ++i) {
		    	cout << ans3[i] << " ";
		    }
		    
		    return 0;
		}
	    
	    return 0;
    }
    
    cout << "No\n";
  
    return 0;
}


Measured memory_bytes: 39492
import sys
sys.setrecursionlimit(10**6)
def dfs(v):
    seen[v]=1
    for nv in G[v]:
        if seen[nv]:
            continue
        dfs(nv)
    topo.append(v)

N,M=map(int,input().split())
G=[[] for i in range(N)]
for i in range(M):
    x,y=map(lambda x:int(x)-1,input().split())
    G[x].append(y)
seen=[0]*N
topo=[]
for i in range(N):
    if not seen[i]:
        dfs(i)
dp=[0]*N
for v in reversed(topo):
    for nv in G[v]:
        dp[nv]=max(dp[nv],dp[v]+1)
print(max(dp))

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

int main() {
  char c;
  cin >> c;

  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
  	cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin>>n;
	vector<long long>a(n);
	for(int i = 0; i < n; i++) {
		cin>>a[i];
	}
	int ok1=1;
	for(int i = 1; i < n; i++) {
		if(a[i]<=a[i-1])ok1=0;
	}
	if(ok1) {
		cout<<1<<endl;
		return 0;
	}
	int s=1,e=n+1;
	while(s+1<e) {
		int m=(s+e)/2;
		int ok=1;
		map<int,int>f;
		int len=0;
		for(int i = 0; i < n; i++) {
			if(a[i]>len) {
				len=a[i];
			} else {
				while(!f.empty() && f.rbegin()->first>=a[i]) {
					f.erase(f.rbegin()->first);
				}
				f[a[i]-1]++;
				int cur=a[i]-1;
				while(f[cur]>=m) {
					f.erase(cur);
					cur--;
					f[cur]++;
					if(cur<0) {
						ok=0;
					}
				}
				if(!ok)break;
				len=a[i];
			}
		}
		if(ok) {
			e=m;
		} else {
			s=m;
		}
	}
	cout<<e<<endl;
	return 0;
}

Measured memory_bytes: 1920
N = int(input())
L = [0 for i in range(9)]
S = list(map(int, input().split()))
for i in range(N):
  p = S[i] // 400
  if p <= 7:
    L[p] += 1
  else:
    L[8] += 1
Z, M, m = 0, 0, 0
for i in range(8):
  if L[i] == 0:
    Z += 1
  else:
    M += 1
    m += 1
M += L[8]
if m == 0 and L[8] != 0:
  m = 1
print(m, M)

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

using i64 = int_fast64_t;
using f64 = double;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    string s;
    cin >> s;
    i64 n = s.size();
    s = '.' + s;

    i64 ans = 0;
    i64 a = 0, bc = 0;
    for (i64 i = n; i > 0;) {
        if (s[i] == 'A') {
            a++, i--, ans += bc;
            continue;
        }

        if (s[i - 1] == 'B' && s[i] == 'C') {
            bc++, i -= 2;
            continue;
        }

        a = 0, bc = 0, i--;
    }

    cout << ans << endl;
}

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


Measured memory_bytes: 788
x1, y1 = [int(_) for _ in input().split()]
x2, y2 = [int(_) for _ in input().split()]
x3, y3 = [int(_) for _ in input().split()]

x2 -= x1
y2 -= y1
x3 -= x1
y3 -= y1

A = ((x2 - x3)**2 + (y2 - y3)**2)**0.5
B = (x3**2 + y3**2)**0.5
C = (x2**2 + y2**2)**0.5
R = abs(x2 * y3 - x3 * y2) / (A + B + C)
#(R-x)/R=2x/D
#x=RD/(2R+D)
D = max(A, B, C)
x = R * D / (2 * R + D)
print(x)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
int q[1005][1005];
main(){
	double n,a,ans=0,i;
	cin>>n;
	for (i=0;i<n;++i){
		cin>>a;
		ans+=1/a;
	}
	cout <<1/ans;
} 

Measured memory_bytes: 256
n=gets.to_i
a=gets.split.map(&:to_i)
b=[a[-1]]
a[0..-2].reverse.each do |aa|
  b << b[-1]+aa
end
b.reverse!
if n==0&&a==[1]
  puts 1
  exit
end
if a[0]!=0
  puts "-1"
  exit
end
c=1
d=1
n.times do |i|
  if d<1
    puts "-1"
    exit
  end
  d*=2
  d=b[i+1] if d>b[i+1]
  c+=d
  d-=a[i+1]
end
if d!=0
  puts "-1"
  exit
end
puts c


Measured memory_bytes: 22444
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <utility>
#include <functional>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	cout << (a + b) % 24 << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int n;
	int count = 0;
	int chk;
	scanf("%d", &n);
	if(n % 2 == 0)n--;
	for(; n >= 105; n -= 2){
		chk = 0;
		for(int i = 1; i <= n; i++){
			if(n % i == 0)chk++;
			if(chk > 8)break;
		}
		if(chk == 8)count++;
	}
	printf("%d\n", count);
	return 0;
}


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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()

int main(){
    cout << setprecision(20);
    ll h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    rep(i, h){
        cin >> s[i];
    }

    vvll a(h, vll(w, 0));
    ll count = 1;
    rep(i, h){
        rep(j, w){
            if(s[i][j]=='#'){
                ll left = j;
                ll right = j;
                while(left>0){
                    if(a[i][left-1]==0 && s[i][left-1]=='.') --left;
                    else break;
                }
                while(right<w-1){
                    if(a[i][right+1]==0 && s[i][right+1]=='.') ++right;
                    else break;
                }
                ll top = i;
                ll bottom = i;
                while(top>0){
                    bool f = true;
                    REP(k, left, right+1){
                        if(a[top-1][k]>0 || s[top-1][k]=='#'){
                            f = false;
                            break;
                        }
                    }
                    if(f) --top;
                    else break;
                }
                while(bottom<h-1){
                    bool f = true;
                    REP(k, left, right+1){
                        if(a[bottom+1][k]>0 || s[bottom+1][k]=='#'){
                            f = false;
                            break;
                        }
                    }
                    if(f) ++bottom;
                    else break;
                }
                REP(k, top, bottom+1){
                    REP(l, left, right+1){
                        a[k][l] = count;
                    }
                }
                ++count;
            }
        }
    }

    rep(i, h){
        rep(j, w){
            cout << a[i][j] << " ";
        }
        cout << endl;
    }
}


Measured memory_bytes: 1664
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

deque<int> dq;
int main() 
{
	int N;
	cin >> N;
	int turn = 0;
	for (int i = 0; i < N; i++) {
		int A; cin >> A;
		if (N % 2 != i % 2) {
			dq.push_front(A);
		}
		else {
			dq.push_back(A);
		}
	}
	for (int i = 0; i < N; i++) {
		cout << dq[i] << " ";
	}
	cout << endl;
}

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

int main() {
	int n,c=0;
	cin >> n;
	for(int i=1;i<=n;i++)
	{
		int a;
		cin >> a;
		if(i%2==0)
		{
			continue;
		}
		if(a%2==1)
		{
			c++;
		}
	}
	cout << c <<endl;
	return 0;
}


Measured memory_bytes: 3564
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>
#include <bitset>
using namespace std;
 
int main(void)
{
	long long N, ans;
	cin >> N;
	ans = N;

	for (long long i = 1; i*i <= N; i++)
	{
		if (N % i == 0)
		{
			ans = min(ans, (long long)(i + (N / i) -  2));
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int               long long
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define loop(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
#define br                break
#define con               continue

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.fr>>a.sc;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.fr<<" "<<a.sc;return out;}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}
 
const long long INF=1e18;
const int32_t M=1e9+7;
const int32_t MM=998244353;

priority_queue<pii, vector<pii>, greater<pii> >q;

#include<bits/stdc++.h>
using namespace std;
signed main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output1.txt","w",stdout);
	#endif
    ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
 
	string s;
	cin>>s;
	int ans=0;
	for(int i=0;i<s.size();i++)ans+=s[i]-48;
	if(ans%9==0)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
 
}


Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<P> a(n);
    rep(i, n)cin >> a[i].second >> a[i].first;
    sort(all(a));
    bool ok = true;
    int now = 0;
    rep(i, n){
        now += a[i].second;
        if(now > a[i].first)ok = false;
    }
    if(ok)cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 1920
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <map>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  int dx[] = {0,1,0,-1};
  int dy[] = {1,0,-1,0};
  map<char,int> mp;
  mp['N'] = 0;
  mp['E'] = 1;
  mp['S'] = 2;
  mp['W'] = 3;
  
  int n;
  while(cin >> n, n) {
    bool gem[21][21] = {}; 
    REP(i,n) {
      int a,b;
      cin>>a>>b;
      gem[a][b] = 1;
    }
    int m;
    cin >> m;
    int x = 10, y = 10;
    int get = 0;
    REP(i,m) {
      char c;
      cin >> c;
      int a;
      cin >> a;
      REP(i,a) {
        x += dx[mp[c]];
        y += dy[mp[c]];
        if (gem[x][y]) {
          gem[x][y] = 0;
          get++;
        }
      }
    }
    if (get == n)
      cout << "Yes"<< endl;
    else
      cout << "No" << endl;
  }
}

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

int main(){
	int n;
	while(cin>>n){
		if(!n) break;
		vector<int> all;
		for(int i=0; i<n; i++){
			int buf;
			cin>>buf;
			all.push_back(buf);
		}
		int m = -10000000;
		for(int i=0; i<n; i++){
			int sum = 0;
			for(int j=i; j<n; j++){
				sum += all[j];
				m = max(m, sum);
			}
		}
		cout<<m<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x;
    cin>>x;
    int a;
    for(int i=0;i<x;i++)
    {
        cin>>a;
        if(a%2==0&&!(a%3==0||a%5==0))
        {
            cout<<"DENIED"<<endl;
            return 0;
        }

    }
    cout<<"APPROVED"<<endl;


   return 0;
}


Measured memory_bytes: 256
/*Author - sambhu show(jgec) */
#include<bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define itc ll t;cin>>t;while(t--)
#define PI 3.141592653589793238
//ang=(PI*ang)/180.0 in radian
#define Max(a,b,c) max(a,max(b,c));
#define Min(a,b,c) min(a,min(b,c));
#define all(v) v.begin(),v.end()
#define ll long long int
#define ld long double
#define pb push_back
#define eb emplace_back
#define gcd(a,b) __gcd(a,b)
#define fi first
#define se second
#define endl "\n"
int dx[4] = {0, -1, 0, 1};
int dy[4] = {1, 0, -1, 0};
int XX[8] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int YY[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int solve(int num)
{
	int c = 0;
	for (int i = 1; i <= sqrt(num); i++)
	{
		for (int j = 1; j <= sqrt(num); j++)
		{
			for (int k = 1; k <= sqrt(num); k++)
			{
				int v = i * i + j * j + k * k + i * j + j * k + k * i;
				if (v == num)
					c++;
				if (v > num)
					break;
			}
		}
	}
	return c;
}
int main()
{
	fio
	int n;
	cin >> n;
	vector<int>ans;

	for (int i = 1; i <= n; i++)
	{
		cout << solve(i) << endl;
	}
	return 0;
}

Measured memory_bytes: 3592
import java.util.Scanner;

/**
 * AOJ id=0023
 * Circles Intersection
 * @author scache
 *
 */
public class Main {
	public static void main(String[] args) {
		Main p = new Main();
	}

	public Main() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(int i=0;i<n;i++){
			double xa = sc.nextDouble();
			double ya = sc.nextDouble();
			double ra = sc.nextDouble();
			double xb = sc.nextDouble();
			double yb = sc.nextDouble();
			double rb = sc.nextDouble();
			solve(xa, ya, ra, xb, yb, rb);
		}
		
	}

	public void solve(double xa, double ya, double ra, double xb, double yb, double rb) {
		double c = (xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);
		double rd = (ra-rb)*(ra-rb);
		double r = (ra+rb)*(ra+rb);
//		double eps = 0;
		if(c<rd && ra>rb)
			System.out.println(2);
		else if(c<rd && ra<=rb)
			System.out.println(-2);
		else if(c<=r)
			System.out.println(1);
		else
			System.out.println(0);
		
		
	}

}

Measured memory_bytes: 18684
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::cmp::{max};

fn main() {
    let cin = stdin();
    let mut scan = Scanner::new(cin.lock());
    let s = scan.chars();
    let n = s.len();
    let mut level = vec![-1i64;n+1];
    let mut pre = '>';
    for i in 0..n {
        if pre == '>' && s[i] == '<' {
            level[i] = 0;
        }
        pre = s[i];
    }
    if s[n-1] == '>' {
        level[n] = 0;
    }
    for i in 0..n {
        if s[i] == '<' && level[i] != -1 {
            level[i+1] = level[i]+1;
        }
    }
//    dbg!(&level);
    for i in (1..n+1).rev() {
        if s[i-1] == '>' && level[i] != -1 {
            level[i-1] = max(level[i-1], level[i]+1);
        }
    }
//    dbg!(&level);
    println!("{}", level.into_iter().sum::<i64>());
}

// region template
#[allow(dead_code)]
fn iu(i: i64) -> usize { i as usize }

#[allow(dead_code)]
fn ui(i: usize) -> i64 { i as i64 }

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

#[allow(dead_code)]
fn arr<'a, S, T>(n: usize, mut f: S) -> Vec<T> where S: FnMut(usize) -> T + 'a {
    (0..n).map(|i| f(i)).collect::<Vec<T>>()
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
// endregion

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

using namespace std;

vector <int> Veca;
int a,c=0,sum=0,p,q;

int main()
{
    for (int i=1;i<=3;i++)
    {
        cin >> a;
        Veca.push_back(a);
    }
    sort(Veca.begin(),Veca.end());

    for (int j=1;j<3;j++)
    {
        c = Veca[j] - Veca[j-1];
        sum += c;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
main()
{
	int br=0, min=1000, n, x, i;
	scanf("%d%d", &n, &x);
	int A[n];
	for(i=0;i<n;i++)
	{
		scanf("%d", &A[i]);
	if (min>A[i])
min=A[i];
	}
	for(i=0;i<n;i++)
	{
		if (x>=min)
		{
	x=x-A[i];
br=br+1;
}
	}
	while (x>=min)
	{
		x=x-min;
	br=br+1;
	}
	printf("%d", br);
	return 0;
}

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

int main(){
  int N,X,Y;
  cin >> N >> X >> Y;
  const int INF=1e8;
  vector< vector<int> > v(N+1);
  for(int i=1;i<N;i++){
    v.at(i).push_back(i+1);
    v.at(i+1).push_back(i);
  }
  v.at(X).push_back(Y);
  v.at(Y).push_back(X);

  vector<int> ans(N,0);
  vector< vector<int> > dist(N+1,vector<int>(N+1,INF));
  for(int i=1;i<=N;i++){
    queue<int> que;
    que.push(i);
    dist.at(i).at(i)=0;
    while(!que.empty()){
      int a=que.front();
      que.pop();
      for(auto b:v.at(a)){
        if(dist.at(i).at(b)==INF){
          que.push(b);
          dist.at(i).at(b)=dist.at(i).at(a)+1;
          ans.at(dist.at(i).at(b))++;
        }
      }
    }
  }
  for(int i=1;i<=N-1;i++){
    cout << ans.at(i)/2 << endl;
  }
  return 0;
}


Measured memory_bytes: 16128