akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
using namespace std;

int main() {
	int sheet[101][101] = { 0 };
	int r, c;
	cin >> r >> c;

	for (int i = 0; i < r; i++) {
		for (int j = 0; j < c; j++) {
			cin >> sheet[i][j];
		}
	}

	for (int i = 0; i < r; i++) {
		for (int j = 0; j < c; j++) {
			sheet[i][c] += sheet[i][j];
			sheet[r][j] += sheet[i][j];
		}
	}
	for (int i = 0; i < r; i++) {
		sheet[r][c] = sheet[r][c] + sheet[i][c];
	}

	for (int i = 0; i <= r; i++) {
		for (int j = 0; j <= c; j++) {
			if (j < c)
				printf("%d ", sheet[i][j]);
			else
				printf("%d\n", sheet[i][j]);
		}
	}
	return 0;
}


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

int n, m, cnt[2], ans = 0;

int main() {
  int i, j, x;
  cin >> m >> n;
  for(i = 0; i < m; ++i) {
    cnt[0] = cnt[1] = 0;
    for(j = 0; j < n; ++j) {
      cin >> x;
      if(i != 0) x = 1 - x;
      if(j == 0 || j == n - 1)
        ++cnt[x];
      else
        ++cnt[1 - x];
    }
    if(n == 1)
      ans += cnt[1];
    else if(cnt[0] == 0)
      ans += cnt[1] - 1;
    else
      ans += cnt[1] + 1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

ll dp[20][2000];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int d,g;
	cin>>d>>g;
	vector<int> p(d),c(d);
	rep(i,d){
		cin>>p[i]>>c[i];
	}
	rep(i,20)rep(j,2000) dp[i][j]=-1;
	dp[0][0]=0;
	rep(i,d)rep(j,1010){
		if(dp[i][j]==-1) continue;
		rep(k,p[i]+1){
			chmax(dp[i+1][j+k],dp[i][j]+(i+1)*100*k);
			if(k==p[i]) chmax(dp[i+1][j+k],dp[i][j]+(i+1)*100*k+c[i]);
		}
	}
	rep(j,1010){
		if(dp[d][j]>=g){
			cout<<j<<endl;
			return 0;
		}
	}
}

Measured memory_bytes: 512
#include <stdio.h>
#include <iostream>
#pragma warning(disable:4996)
unsigned long long int h, n, a[100000];
unsigned long long int b = 0;

int main()
{

	scanf("%llu %llu", &h, &n);
	for (int i = 0; i != n; i++) {
		scanf("%llu", &a[i]);
	}
	for (int i = 0; i != n; i++) {
		b = b + a[i];
	}
	if (b >= h) {
		printf("Yes");
	}
	else {
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
//#include<vector>

int main(){
	double n;
	double cw=0, ccw=0;
	std::cin>>n;

	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) {
			cw=cw+1.0;
		}
	}

	
	std::cout << cw / n << std::endl;
	
	return 0;
}

Measured memory_bytes: 256
def collatz(n):
    if n%2==0:
        return int(n/2)
    else:
        return 3*n+1
    
s=int(input())

a_list=[s]
i=1
while True:
    i+=1
    s=collatz(s)
    if s in a_list:
        break
    else:
        a_list.append(s)
print(i)

Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <stack>

using namespace std;

const int max_v = 101;
vector<vector<int> > adj_list;
int d[max_v] = { 0 };
int f[max_v] = { 0 };
int discovered[max_v] = { 0 };
int t = 1;

// Depth-first Search ( Stack implementation)
void DFS(int v)
{
	stack<int> S;
	S.push(v);
	discovered[v] = 1;
	d[v] = t++;
	int i = 0;
	while (!S.empty()) {
		v = S.top();
		if (i < adj_list[v - 1].size()) {
			int u = adj_list[v - 1][i++];
			if (discovered[u] == 0) {
				discovered[u] = 1;
				d[u] = t++;
				S.push(u);
				i = 0;
			}
		}
		else {
			S.pop();
			f[v] = t++;
			i = 0;
		}
	}
}

int main(int argc, char** argv)
{
	// Input
	int n;
	int u, k;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		int v;
		vector<int> adj;
		for (int j = 0; j < k; j++) {
			cin >> v;
			adj.push_back(v);
		}
		adj_list.push_back(adj);
	}

	// Depth-first Search
	for (int i = 1; i <= n; i++) {
		if(discovered[i] == 0)
			DFS(i);
	}

	// Output
	for (int i = 1; i <=n; i++) {
		cout << i << " " << d[i] << " " << f[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 3148
#include<cstdio>
const int MAXN = 20000;
int dp[MAXN + 5];
int main() {
	int a, b, c, X;
	scanf("%d%d%d%d",&a,&b,&c,&X);
	dp[0] = 1;
	for(int i=X;i>=0;i--) {
		for(int j=1;j<=c;j++) {
			if( j * 50 > i ) break;
			dp[i] += dp[i - j*50];
		}
	}
	for(int i=X;i>=0;i--) {
		for(int j=1;j<=b;j++) {
			if( j * 100 > i ) break;
			dp[i] += dp[i - j*100];
		}
	}
	for(int i=X;i>=0;i--) {
		for(int j=1;j<=a;j++) {
			if( j * 500 > i ) break;
			dp[i] += dp[i - j*500];
		}
	}
	printf("%d",dp[X]);
}

Measured memory_bytes: 256
import scala.io.StdIn.readLine
import scala.collection.mutable.ArrayBuffer

object Main {
  def main(args:Array[String]) = {
    var n = 0
    val b = new ArrayBuffer[String]
    while({n=readLine.trim.toInt;n}!=0) {
      val a = Array.ofDim[Int](n,n)
      var (i,j,m) = (n/2+1,n/2,1)
      a(i)(j) = m
      m += 1
      i += 1
      j += 1
      while(m<=n*n) {
        if(j>=n) j=0 else if(j<0) j=n-1
        if(i>=n) i=0
        if(a(i)(j)!=0) {
          i += 1
          j -= 1
        } else {
          a(i)(j) = m
          m += 1
          i += 1
          j += 1
        }
      }
      b+=a.map(s=>s.map("%4d".format(_)).mkString).mkString("\n")
    }
    println(b.mkString("\n"))
  }
}

Measured memory_bytes: 45772
#include<iostream>
using namespace std;
int main()
{
	string s;
	long long k,n,l=0,ans=1;
	cin>>n;
	cin>>s;
	n*=2;
	for(int i=0;i<n;i++)
	{
		k=l%2;
		if(i>0 &&i<=n/2)
		{
			ans*=i;
			ans%=1000000007;
		}
		if((s[i]=='B' && k==1) || (s[i]=='W' && k==0))
		{
			ans*=l;
			ans%=1000000007;
			l--;
		}
		else
			l++;
		if(l<0 || l>n/2)
			break;	
	}
	if(l!=0)
		cout<<0<<endl;	
	else	
		cout<<ans%1000000007<<endl;
} 

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

static const int N = 4;
static const int N2 = 16;
static const int LIMIT = 100;

static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];

struct Puzzle {
    int f[N2];
    int space;
    int MD;
};

Puzzle state;

int limit;
int path[LIMIT];

int getAllMD(Puzzle pz) {
    int sum = 0;
    for (int i = 0; i < N2; i++) {
        if (pz.f[i] == N2) continue;
        sum += MDT[i][pz.f[i] - 1];
    }
    return sum;
}

bool isSolved() {
    for (int i = 0; i < N2; i++) {
        if (state.f[i] != i + 1) return false;
    }
    return true;
}

bool dfs(int depth, int prev) {
    if (state.MD == 0) return true;
    if (depth + state.MD > limit) return false;
    int sx = state.space / N;
    int sy = state.space % N;
    Puzzle tmp;

    for (int r = 0; r < 4; r++) {
        int tx = sx + dx[r];
        int ty = sy + dy[r];
        if (tx < 0 || ty < 0 || tx >= N || ty >= N) continue;
        if (max(prev, r) - min(prev, r) == 2) continue;
        tmp = state;

        state.MD -= MDT[tx * N + ty][state.f[tx * N + ty] - 1];
        state.MD += MDT[sx * N + sy][state.f[tx * N + ty] - 1];
        swap(state.f[tx * N + ty], state.f[sx * N + sy]);
        state.space = tx * N + ty;
        if (dfs(depth + 1, r)) {
            path[depth] = r; return true;
        }
        state = tmp;
    }
    return false;
}

string iterative_deepening(Puzzle in) {
    in.MD = getAllMD(in);

    for (limit = in.MD; limit <= LIMIT; limit++) {
        state = in;
        if (dfs(0, -100)) {
            string ans = "";
            for (int i = 0; i < limit; i++) ans += dir[path[i]];
            return ans;
        }
    }
    return "unsolvalbe";
}

int main() {
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    for (int i = 0; i < N2; i++) {
        for (int j = 0; j < N2; j++) {
            MDT[i][j] = abs(i / N - j / N) + abs(i % N - j % N);
        }
    }
    Puzzle in;
    for (int i = 0; i < N2; i++) {
        cin >> in.f[i];
        if (in.f[i] == 0) {
            in.f[i] = N2;
            in.space = i;
        }
    }
    string ans = iterative_deepening(in);
    cout << ans.size() << endl;
    return 0;
}

Measured memory_bytes: 3176
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
    	Scanner input = new Scanner(System.in);
    	int[] num = new int[100];
    	while(input.hasNext()){
    		num[input.nextInt()-1]++;
    	}
    	int maxcount = 0;
    	for(int i = 0 ; i < 100 ; i++){
    		maxcount = Math.max(num[i], maxcount);
    	}
    	for(int i = 0 ; i < 100 ; i++){
    		if(num[i] == maxcount)System.out.println((i+1));
    	}
		
    }
}

Measured memory_bytes: 18120
<?php

    $array_num = trim(fgets(STDIN));
    $input = trim(fgets(STDIN));
    $array = explode(' ',$input);

    $j = 0;
    $num = 0;
    while ($j == 0) {
        
        $count = 0;
        for ($i=0; $i<$array_num; $i++){
            
          if ($array[$i]%2 == 0) {
              $count++;
              $array[$i] = $array[$i]/2;
          }
          
          if ($i == $array_num-1){
              if ($count == $array_num){
                $num++;
              } else {
                 $j = 1;
              }
          }
          
        }
        
    }

    echo $num;
?>

Measured memory_bytes: 4212
import java.io.*;
import java.lang.*;
import java.util.*;

class Main {
	static int[] parents;
	static int[] weight;
	static int[] rank;

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

		int n = scanner.nextInt();
		int q = scanner.nextInt();

		parents = new int[n];
		weight = new int[n];
		rank = new int[n];

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

		int type, x, y, z;
		for (int i = 0; i < q; i++) {
			type = scanner.nextInt();
			x = scanner.nextInt();
			y = scanner.nextInt();

			if(type == 0) {
				z = scanner.nextInt();
				relate(x, y, z);
			} else {
				diff(x, y);
			}
		}
	}

	static int find(int x) {
		if (x == parents[x]) 
			return x;
		else {
			int r = find(parents[x]);
			weight[x] += weight[parents[x]];
			return parents[x] = r;
		}
	}

	static int weight(int x) {
		find(x);
		return weight[x];
	}

	static void relate(int x, int y, int z) {
		z += weight(x);
		z -= weight(y);
		x = find(x);
		y = find(y);
		if(x == y) return;
		if(rank[x] < rank[y]){
			int tmp = x;
			x = y;
			y = tmp;
			z = -z;
		}

		if(rank[x] == rank[y]){
			rank[x]++;
		}

		parents[y] = x;
		weight[y] = z;
	}

	static void diff(int x, int y) {
		if(find(x) == find(y)) {
			System.out.println(weight(y) - weight(x));
		} else {
			System.out.println("?");
		}
	}
}


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


 
 
 
int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
ll n;
cin>>n;
long double a[n];
ll i=0;
while(i<n)
{
    cin>>a[i];
    
    i++;
}
if(n==2)
{
    long double m=a[0]+a[1];
    long double mg=2;
    long double s=m/mg; 
    cout.setf(ios::fixed,ios::floatfield);
    cout.precision(9);
    
    cout<<s;
}
else
{
    sort(a,a+n);
  ll k=1;
  long double s=0;
    i=n-1;
    while(i>=2)
    {
        ll mg=pow(2,k);
        long double k2=mg;
        //cout<<k2;
        
        
        long double k3=a[i]/mg;
        s=s+k3;
        k++;
        i--;
    }
    ll mg=pow(2,k);
     long double k3=(a[0]+a[1])/mg;
    s=s+k3;
    
      cout.setf(ios::fixed,ios::floatfield);
    cout.precision(9);
    



    
    cout<<s;
}
//cout<<pow(2,50);



	return 0;
}



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

int main(void) {
  long long int N;
  cin >> N;
  long long int A[N] = {0},d;
  for(int i=1;i<N;i++) {
    cin >> d;
    A[d-1]++;
  }
  for(int i=0;i<N;i++) cout << A[i] << endl;
  return 0;
}


Measured memory_bytes: 5144
N = int(input())
xy = []
xy = [list(map(int,input().split())) for i in range(N)]

import itertools

seq = [i for i in range(N)]
seq2 = list(itertools.combinations(seq,2))

suml = 0

for i in range(len(seq2)):
    x = xy[seq2[i][0]][0] - xy[seq2[i][1]][0]
    y = xy[seq2[i][0]][1] - xy[seq2[i][1]][1]
    length = (x**2 + y**2)**0.5
    suml += length
    
print(suml*2/N)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
int main(){
  ll N,C,i,j,x,v;scanf("%lld%lld",&N,&C);
  ll nowr = 0,nowl = 0;
  pair<ll,ll> S[N],R[N+1],R2[N+1],L[N+1],L2[N+1];
  for(i=0;i<N;i++) scanf("%lld%lld",&S[i].first,&S[i].second);
  R[0] = R2[0] = L[0] = L2[0] = make_pair(0,0);
  for(i=1;i<=N;i++){
    nowr += S[i-1].second;
    R[i] = make_pair(S[i-1].first,max(R[i-1].second,nowr-S[i-1].first));
    R2[i] = make_pair(S[i-1].first,max(R2[i-1].second,nowr-S[i-1].first*2));
  }
  for(i=1;i<=N;i++){
    nowl += S[N-i].second;
    L[i] = make_pair(C-S[N-i].first,max(L[i-1].second,nowl-(C-S[N-i].first)));
    L2[i] = make_pair(C-S[N-i].first,max(L2[i-1].second,nowl-(C-S[N-i].first)*2));
  }
  ll ans = 0;j = N;
  for(i=0;i<=N;i++){
    while(L2[j].first+R[i].first >= C) j--;
    ans = max(ans,R[i].second+L2[j].second);
  }
  i = N;
  for(j=0;j<=N;j++){
    while(L[j].first+R2[i].first >= C) i--;
    ans = max(ans,R2[i].second+L[j].second);
  }
  printf("%lld\n",ans);
  /*for(i=0;i<=N;i++) printf("%lld %lld|%lld %lld\n",R[i].first,R[i].second,R2[i].first,R2[i].second);
  printf("-----------\n");
  for(i=0;i<=N;i++) printf("%lld %lld|%lld %lld\n",L[i].first,L[i].second,L2[i].first,L2[i].second);*/
}

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

    int N = sc.nextInt();
    int ans =-1;
    for(int i=0;i<60000;i++){

      if(Math.floor((double)i*1.08)==N){
        ans=i;
      }
    }
    if(ans==-1){
      System.out.println(":(");
    }else{
      System.out.println(ans);
    }
  }
  

  
}


Measured memory_bytes: 25044
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define FOR(x, b, e) for(int x=(b); x<=(e); ++x)
#define FORD(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define REP(x, n) for(int x=0; x<(n); ++x)
#define ALL(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = 998244353;
const int nax = 202010;
// ll f[nax][nax];
ll sil[nax];

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

ll odw(ll x) {
	return pot(x, mod - 2);
}

ll choose(ll n, ll k) {
	ll wyn = (sil[n] * odw(sil[k])) % mod;
	return (wyn * odw(sil[n - k])) % mod;
}

int main() {
	ios_base::sync_with_stdio(false);
	int n, m, kk;
	cin >> n >> m >> kk;
	// f[1][0] = m;
	sil[0] = 1;
	FOR(i, 1, n) {
		sil[i] = (sil[i-1] * i) % mod;
	}
	ll res = 0;
	FOR(k, 0, kk) {
		ll pom = (choose(n - 1, k) * m ) % mod;
		pom = (pom * pot(m - 1, n - k - 1)) % mod;
		res = (res + pom) % mod;
	}
	cout << res << endl;
	// FOR(i, 2, n) {
	// 	FOR(k, 0, i - 1) {
	// 		f[i][k] = ((m-1) * (f[i - 1][k])) % mod;
	// 		if (k) {
	// 			f[i][k] = (f[i][k] + (f[i-1][k-1])) % mod;
	// 		}
	// 		ll kol = pot(m - 1, i - k - 1);
	// 		printf("f(%d, %d) = %lld, podzielone : %lld\n", i, k, f[i][k], f[i][k] / choose(i-1, k) / m / kol);
	// 	}
	// }
}

Measured memory_bytes: 5200
using System.Linq;
using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        var t = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < t; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var n = int.Parse(line[0]);
            var k = int.Parse(line[1]);
            string[] line2 = Console.ReadLine().Trim().Split(' ');
            var a = Array.ConvertAll(line2, int.Parse);
            var deff = new List<int>();
            for (int j = 1; j < n; j++) deff.Add(a[j] - a[j - 1]);
            deff.Sort();
            var ret = 0;
            for (int j = 0; j < deff.Count() - k+1 ; j++) ret += deff[j];
            Console.WriteLine(ret);
        }
    }
}

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


int main() {
    string S;
    cin>>S;
    int a=S.size();
    int ans;
    int mx=0;
    rep(i,a){
        ans=0;
        while(S[i]=='A'||S[i]=='C'||S[i]=='G'||S[i]=='T'){
            ans++;
            i++;
        }
        mx =max(mx,ans);
    }
    cout<<mx<<endl;
}

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

int main() {
  int n,m;
  cin >> n >> m;
  vector<int> a(m),b(m),c(n+1);
  for(int i=0;i<m;i++){
    cin >> a.at(i) >> b.at(i);
    c.at(a.at(i))++;
    c.at(b.at(i))++;
  }
  for(int i=1;i<=n;i++){
    cout << c.at(i) << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

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

            long[] fib = new long[n + 1];
            fib[0] = 1;
            fib[1] = 1;

            int count = 2;
            while (fib[n] == 0)
            {
                fib[count] = fib[count - 1] + fib[count - 2];
                count++;
            }



            Console.WriteLine(fib.Last());
            Console.ReadKey();
        }

        static int[] ReadInt()
        {
            int[] ret = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return ret;
        }
        static long[] ReadLong()
        {
            long[] ret = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return ret;
        }
    }
}



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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using namespace std;
using R=long double;
const R eps=1e-11; // [-1000:1000]->EPS=1e-8 [-10000:10000]->EPS=1e-7
const R pi=acos(-1);
const R inf=1e40;
inline int sgn(const R& r){ return (r > eps) - (r < -eps);}
inline int sgn(const R& a, const R &b){ return sgn(a-b); }
inline R sq(R x){return sqrt(max<R>(x,0.0));}

int n;
R vx[110],vy[110],r;

R val(R x){
	R ret=0.0;
	rep(i,n-1){
		if(vx[i]<=x&&x<vx[i+1]){
			R rate=(x-vx[i])/(vx[i+1]-vx[i]);
			ret=vy[i]+rate*(vy[i+1]-vy[i]);
			return ret;
		}
	}
	return ret;
}

R func(R x){ return 1.0*val(x)*val(x+r); }

int main(void){
	while(cin >> n >> r,n){	
		vector<R> ary;
		rep(i,n) cin >> vx[i] >> vy[i];
		rep(i,n) ary.push_back(vx[i]),ary.push_back(vx[i]+r),ary.push_back(vx[i]-r);
		
		uniq(ary);
		int m=ary.size();

		R ans=0.0;
		rep(i,m-1){
			R a=ary[i],b=ary[i+1],c=(a+b)/2.0;
			R fa=func(a),fb=func(b),fc=func(c);
			R cur=(fa+4.0*fc+fb)*(b-a)/6.0;
			ans+=cur;
		}
		cout.precision(20);
		cout << fixed << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3160
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <set>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


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

    // input
    string S;
    cin >> S;
    
    // calculation
    REP(i, 19) {
        if (S[i] == ',') {
            cout << ' ';
        } else {
            cout << S[i];
        }
    }
    cout << "\n";
    
    return 0;
}


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

public class Main {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    static FastReader s = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);

    private static int[] rai(int n) {
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextInt();
        }
        return arr;
    }

    private static int[][] rai(int n, int m) {
        int[][] arr = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextInt();
            }
        }
        return arr;
    }

    private static long[] ral(int n) {
        long[] arr = new long[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextLong();
        }
        return arr;
    }

    private static long[][] ral(int n, int m) {
        long[][] arr = new long[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextLong();
            }
        }
        return arr;
    }

    private static int ri() {
        return s.nextInt();
    }

    private static long rl() {
        return s.nextLong();
    }

    private static String rs() {
        return s.next();
    }
    static int gcd(int a,int b)
    {
        if(b==0)
        {
            return a;
        }
        return gcd(b,a%b);
    }


    public static void main(String[] args) {
        StringBuilder ans = new StringBuilder();
//        int t = ri();
        int t=1;
        while (t-- > 0) {
            int n=ri();
            int x=ri();int time=ri();

            int count=n/x;
            if(n%x!=0)
            {
                count++;
            }
            ans.append(count*time).append("\n");
        }
        out.print(ans.toString());
        out.flush();

    }

}


Measured memory_bytes: 25396
N = int(input())
h = [int(x) for x in input().split()]
cost = [0] * N

cost[0] = 0
cost[1] = abs(h[1] - h[0])

for i in range(N - 2):
    c1 = cost[i] + abs((h[i + 2] - h[i]))
    c2 = cost[i + 1] + abs((h[i + 2] - h[i + 1]))
    if c1 > c2:
        cost[i + 2] = c2
    else:
        cost[i + 2] = c1

print(cost[N-1])


Measured memory_bytes: 13980
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
ll dp[102][1000002];
ll func(int n, int w, std::vector<pair<ll, ll>> &v) {

    if(n == 0 || w <= 0) {
        return 0;
    }
    if(dp[n][w] != -1) {
        return dp[n][w];
    }
    dp[n][w] = func(n - 1, w, v);
    if(w >= v[n].first) {
        dp[n][w] = max(dp[n][w], func(n - 1, w - v[n].first, v) + v[n].second);
    }
    // dp[n][w] = max(func(n - 1, w, v), func(n - 1, w - v[n].first, v) + v[n].second);
    return dp[n][w];

}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n, w, i, j;
    cin >> n >> w;
    std::vector<pair<ll, ll>> v(n + 1);
    for(i = 1; i <= n; i++) {
        cin >> v[i].first >> v[i].second;
    }
    memset(dp, -1, sizeof(dp));
    ll ans = func(n, w, v);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 797184
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <random>
#include <chrono>
#include <iomanip>
#define lint long long int
#define FOR(x, to) for(int x=0; x<(int)(to); x++)
#define DUMP(ar) for(int loop_dump=0; loop_dump<(int)ar.size(); loop_dump++) cout << "[" << loop_dump << "]:" << ar[loop_dump] << endl
#define DUMPL(ar) for(int loop_dump=0; loop_dump<(int)ar.size(); loop_dump++) { cout << ar[loop_dump]; if(loop_dump<(int)ar.size()-1) cout << ' '; } cout << endl;
#define COUT(x) cout << x << endl
#define ALL(ar) ar.begin(), ar.end()
#define LOOPD(i) cout << "ループ[" << i << "]回目---------------" << endl
using namespace std;

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

    int n;
    string s, t;
    cin >> n;
    cin >> s >> t;

    string ans;
    for(int i=0; i<n; i++){
        ans.push_back(s[i]);
        ans.push_back(t[i]);
    }

    COUT(ans);

    return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc160/tasks/abc160_a

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  string S;
  cin >> S;

  if (S[2] == S[3] && S[4] == S[5]) {
    drop("Yes");
  } else {
    drop("No");
  }
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
using System;

namespace ABC161c
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Split(' ');
            long n = long.Parse(s[0]);
            long k = long.Parse(s[1]);

            if(n % k == 0)
            {
                Console.WriteLine(0);
                return;
            }
            else if(n > k)
            {
                n = n % k;
            }

            long n2 = k - n;

            if(n < n2)
            {
                Console.WriteLine(n);
            }
            else
            {
                Console.WriteLine(n2);
            }
        }
    }
}

Measured memory_bytes: 13140
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <iterator>
#include <algorithm>
#include <cfenv>
#include <random>
#include <numeric>
#include <cmath>
#include <iosfwd>
#include <iostream>
#include <ios>
#include <streambuf>
#include <istream>
#include <ostream>
#include <iomanip>
#include <sstream>
#include <fstream>
 
typedef long long ll;
 
using namespace std;
 
int main(){
    int N;
    int A[500000];
    int ans[500000];
    cin >> N;
    for(int i = 0 ; i < 100000 ; i++){
        ans[i] = 0;
    }
    for(int i = 0 ; i < N - 1 ; i++){
        cin >> A[i];
        ans[A[i] - 1]++;
    }
    for(int i = 0 ; i < N ; i++){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 5168
import java.util.Scanner;

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

        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int d = scanner.nextInt();

        String ans = "No";

        int a2c = Math.abs(a-c);
        if (a2c<=d){
            ans="Yes";
        }else{
            int a2b = Math.abs(a-b);
            int b2c = Math.abs(b-c);
            if (a2b<=d && b2c<=d){
                ans="Yes";
            }
        }

        System.out.println(ans);
        scanner.close();
    }
}


Measured memory_bytes: 21716
#include<iostream>

using namespace std;

int main(){

	int A,B,C,X;
	int a,b,c;
	bool flag;
	int i,j,k;
	int res=0;

	cin >>A>>B>>C>>X;

	flag=1;


	for(k=0;k<=A;k++){
		for(j=0;j<=B;j++){
			for(i=0;i<=C;i++){

				if(X-500*k-100*j-50*i ==0) res++;

				//cout<<k<<" " <<j<<" "<<i <<" "<<500*k+100*j+50*i<< " "<<res <<endl;

			}

		}

	}



	cout << res <<endl;


}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define ALLG(v) v.begin(), v.end() ,greater<int>()
typedef long long ll;
ll GCD(ll x, ll y) { return y ? GCD(y, x % y) : x; }
ll LCM(ll x, ll y) { return x * y / GCD(x, y); }

using namespace std;
int main() {
	string s;
	cin >> s;


	int n = s.size();

	if(s.substr(0, (n-1)/2) == s.substr((n + 3) / 2-1,n)){
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;

	}
	
}


Measured memory_bytes: 256
#include<cstdio>
using namespace std;
char a[20];
int main()
{
	//freopen("r.txt","r",stdin);
    scanf("%s",a);
    printf("%c",a[0]);
    printf("%c",a[1]);
    printf("%c",a[2]);
    printf("%c",a[3]);
    printf("%c",a[4]);
    printf(" ");
    printf("%c",a[6]);
    printf("%c",a[7]);
    printf("%c",a[8]);
    printf("%c",a[9]);
    printf("%c",a[10]);
    printf("%c",a[11]);
    printf("%c",a[12]);
    printf(" ");
    printf("%c",a[14]);
    printf("%c",a[15]);
    printf("%c",a[16]);
    printf("%c",a[17]);
    printf("%c",a[18]);
    return 0;
}

Measured memory_bytes: 128
import scala.collection.mutable._
import io.StdIn.readInt
import io.StdIn.readLine

object Main extends App {
  val out = new java.io.PrintWriter(System.out)

  def calculate(q:Array[Int],d:Array[Array[Int]]):Int = {
    val ts = q(0)
    val te = q(1)
    val st = q(2)

    val a = d.filter(_(2) == st)
    val map = new HashMap[Int,Array[Int]]
    val log = ListBuffer.empty[Tuple2[Int,Int]]
    a.foreach(l => {
      if(l(3) == 1) map.put(l(1),l)
      else {
        val e = map.remove(l(1)).get
        log += {( e(0), l(0) )}
        }
    })
    // println(log.mkString)

    val time = Array.fill[Int](721)(0)
    log.foreach(t => {
      val s = math.max(ts, t._1) -540
      val e = math.min(te, t._2) -540
      (s until e).foreach(time(_) = 1)
    })
    time.sum
  }

  def solve(s:String):Unit = {
    val Array(n, m) = s.split(" ").map(_.toInt)
    val r = readInt
    val d = Iterator.continually(readLine)
      .take(r)
      .map(_.split(" ").map(_.toInt))
      .toArray
    val q = readInt
    Iterator.continually(readLine)
      .take(q)
      .map(_.split(" ").map(_.toInt))
      .foreach(qd => out.println(calculate(qd,d)))
  }

  Iterator.continually(readLine)
    .takeWhile(_ != "0 0")
    .foreach(solve(_))
  
  out.flush
}


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

int main() {
	string A, B;
	cin >> A>>B;

	int a = (int)A.length();
	int b = (int)B.length();
	//大小のフラグ
	int f = 0;
	int u = (int)A[0];
	int v = (int)B[0];

	if (a<b) { f = 2; }
	else if (a>b) { f = 1; }
	else {
		for (int i = 0;i < a;i++) {
			int x = (int)A[i];
			int y = (int)B[i];
			if (x < y) {
				f = 2;
				break;
			}
			else if (x > y) {
				f = 1;
				break;
			}
		}
	}
	if (f == 1) {
		cout << "GREATER";
	}
	else if (f == 2) {
			cout << "LESS";
	}
	else {
			cout << "EQUAL";
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int N, M, i, a, b;
  cin >> N >> M;
  vector<int> vec(N);
  for (i=0; i<M; i++) {
    cin >> a >> b;
    vec.at(a-1)+=1;
    vec.at(b-1)+=1;
  }
  for (i=0; i<N; i++) {
    cout << vec.at(i) << endl;
  }
  return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int a,b;
    string M[105];
    while(cin >> a >> b)
    {
        // init
        for(int i = 0; i < 50; i++)
            M[i] = string(100, '#');
        for(int i = 50; i < 100; i++)
            M[i] = string(100, '.');
        // build
        for(int i = 0; i < a-1; i++)
            M[i/50*2][i%50*2] = '.';
        for(int i = 0; i < b-1; i++)
            M[99-(i/50*2)][i%50*2] = '#';
        // print
        cout << "100 100" << '\n';
        for(int i = 0; i < 100; i++)
            cout << M[i] << '\n';
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include <stdlib.h>
#include<string.h>

int  hantei(char str[],int i){
	switch(str[i]){
		case '0':
		return 0;
		break;
		
		case '1':
		return 1;
		break;
		
		case '2':
		return 2;
		break;
		
		case '3':
		return 3;
		break;
		
		case '4':
		return 4;
		break;
		
		case '5':
		return 5;
		break;
		
		case '6':
		return 6;
		break;
		
		case '7':
		return 7;
		break;
		
		case '8':
		return 8;
		break;
		
		case '9':
		return 9;
		break;
	}
}


int main(){
	char str[100000]={'\0'};
	int i,n,j;
	
	while(fgets(str,sizeof(str),stdin)!=NULL){
	
	for(i=0;i<strlen(str);i++){
		if(str[i]=='@'){
			i++;
			n=hantei(str,i);
			i++;
			for(j=0;j<n;j++)printf("%c",str[i]);
		}
		else printf("%c",str[i]);
	}
		for(i=0;i<strlen(str);i++)str[i]='\0';
		n=0;
	}
	
return 0;
}

Measured memory_bytes: 584
#include<iostream>
#include<queue>
#include<cmath>
#include<algorithm>
using namespace std;
int n;
long long a,b,c,d;
long long e,f;
int main(){
	ios::sync_with_stdio(false);
	cin >> n >> a >> b >> c >> d;
	e=c;f=d;
	for(int i=0; i<=n-1 ;i++){
		e=c*i-d*(n-1-i);
		f=d*i-c*(n-1-i);
		if(abs(a-b)>=e && abs(a-b)<=f){
			cout << "YES\n";
			return 0;
		}
	}
	cout << "NO\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <array>
#include <cmath>
#include <random>
#include <functional>
#include <climits>
#include <iomanip>
using namespace std;
using lint=long long;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  cout<<(s.at(0)=='7' ? "Yes" : s.at(1)=='7' ? "Yes" : s.at(2)=='7' ? "Yes" : "No")<<endl;
  return 0;
}


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

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

	string S;
	cin >> S;

	map<string, int> m {
		{ "SUN", 7 },
		{ "MON", 6 },
		{ "TUE", 5 },
		{ "WED", 4 },
		{ "THU", 3 },
		{ "FRI", 2 },
		{ "SAT", 1 }
	};
	cout << m[S] << endl;

	return 0;
}


Measured memory_bytes: 256
#

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    S=input().strip("\n")
    if N%2==1:
        print("No")
    elif S[:(N//2)]==S[(N//2):]:
        print("Yes")
    else:
        print("No")
    
    
    
if __name__=="__main__":
    main()


Measured memory_bytes: 61632
#include <stdio.h>
#include <string.h>

#define MIN(A,B) (A)<(B)?(A):(B)
#define MAX(A,B) (A)>(B)?(A):(B)

#define N 5

int main(){
  int n, a, b, c=0, i;
  char S[N], T[N];
  scanf("%d", &n);
  printf("%d\n", n*n*n);
  return 0;
}


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

int main() {
    int s;
    cin >> s;
    int c1 = s / 100;
    int c2 = s % 100 / 10;
    int c3 = s % 10;
    cout << c1 + c2 + c3 << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> v;
    for(int i=0;i<n;++i){
        int d;
        cin >> d;
        v.push_back(d);
    }
    sort(v.rbegin(),v.rend());
    int ans = 1;
    for(int i=1;i<n;++i){
        if(v[i] < v[i-1])ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<queue>
#include<set>
#define maxn 100010
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,A,B,D;
struct P{
    int x,y;
}p[maxn];
int a[maxn],top1;
int b[maxn],top2;
map<pii,int>ma;
set<pii>X[maxn],Y[maxn];
vector<int>f[maxn],g[maxn];
int find1(int x)
{
    return lower_bound(a+1,a+top1+1,x)-a;
}
int find2(int x)
{
    return lower_bound(b+1,b+top2+1,x)-b;
}
queue<int>q;
ll ans;
int vis[maxn];
void work(set<pii> &s,vector<int>v,int l,int r)
{
    set<pii>::iterator it=s.lower_bound(mp(l,0));
    while(it!=s.end()&&(it->fi)<=r)
    {
        if(!vis[it->se])
        {
            vis[it->se]=1;
            q.push(it->se);
        }
        set<pii>::iterator it2=it;it2++;
        s.erase(it);it=it2;
    }
    int L=lower_bound(v.begin(),v.end(),l)-v.begin();
    int R=upper_bound(v.begin(),v.end(),r)-v.begin();
    ans+=R-L;
}
int main()
{
    n=read();A=read();B=read();
    for(int i=1;i<=n;i++)  p[i].x=read(),p[i].y=read();
    for(int i=1;i<=n;i++)
    {
        int x=p[i].x,y=p[i].y;
        p[i].x=x+y;
        p[i].y=x-y;
        ma[mp(p[i].x,p[i].y)]=1;
    }
    D=max(abs(p[A].x-p[B].x),abs(p[A].y-p[B].y));
    for(int i=1;i<=n;i++)  a[++top1]=p[i].x;
    for(int i=1;i<=n;i++)  b[++top2]=p[i].y;
    sort(a+1,a+top1+1);
    top1=unique(a+1,a+top1+1)-a-1;
    sort(b+1,b+top2+1);
    top2=unique(b+1,b+top2+1)-b-1;
    for(int i=1;i<=n;i++)
    {
        X[find1(p[i].x)].insert(mp(p[i].y,i));
        f[find1(p[i].x)].push_back(p[i].y);
        Y[find2(p[i].y)].insert(mp(p[i].x,i));
        g[find2(p[i].y)].push_back(p[i].x);
    }
    for(int i=1;i<=top1;i++)  sort(f[i].begin(),f[i].end());
    for(int i=1;i<=top2;i++)  sort(g[i].begin(),g[i].end());
    q.push(A);
    vis[A]=1;
    while(q.size())
    {
        int now=q.front();
        q.pop();
        int L=find1(p[now].x-D),R=find1(p[now].x+D);
        int U=find2(p[now].y+D),Dx=find2(p[now].y-D);
        if(a[L]==p[now].x-D)  work(X[L],f[L],p[now].y-D,p[now].y+D);
        if(a[R]==p[now].x+D)  work(X[R],f[R],p[now].y-D,p[now].y+D);
        if(b[U]==p[now].y+D)  work(Y[U],g[U],p[now].x-D,p[now].x+D);
        if(b[Dx]==p[now].y-D) work(Y[Dx],g[Dx],p[now].x-D,p[now].x+D);
        ans-=ma[mp(p[now].x-D,p[now].y-D)]+ma[mp(p[now].x-D,p[now].y+D)]+ma[mp(p[now].x+D,p[now].y-D)]+ma[mp(p[now].x+D,p[now].y+D)];
    }
    cout<<ans/2<<endl;
    return 0;
}

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

int a, b, c, d, e;

int main() {
    cin >> a >> b >> c >> d >> e;
    vector<int> s;
    s.push_back(a);
    s.push_back(b);
    s.push_back(c);
    s.push_back(d);
    s.push_back(e);

    for (int i = 0; i < 5; i++) {
        if (s.at(i) == 0) {
            cout << i + 1 << endl;
        }
    }
}

Measured memory_bytes: 3612
#include<stdio.h>
#include<string.h>

#define M  1000007/* your task*/
#define L 14

char H[M][L]; /* Hash Table */

int num;

int getChar(char);

long long getKey(char *);

int hi(int);

int h2(int);

int h (long long,int);

int find(char *);

int insert(char *);

int main(){
  int i, n;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    num = n;
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	}
	else {
	    if (find(str) == 1){
		printf("yes\n");
	    }
	    else {
		printf("no\n");
	    }
	}
    }

    return 0;
}



int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/*convert a string into an integer value */

long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}


int h1(int key){
  return key % M; 
   /* your task */;
}

int h2(int key){
  return 1 + (key % (M-1));
    /* your task */;
}

int h(long long key,int i){
  return (int)(((long)h1(key) + i * h2(key))%M);
}

int find(char str[]){
    /* your task */
  int i=0;
  int j;
  while(1){
    j = h(getKey(str),i);
    if(strcmp(H[j],str) == 0) return 1;
    else if(H[j][0] == '\0' || i >= num) return NULL;
    else i = i+1;
  }
  
}

int insert(char str[]){
  int i=0;
  int j;
  while(1){
    j = h(getKey(str),i);

    //printf("j = %d %s\n", j, str);
    if(H[j][0] == '\0'){
      strcpy(H[j],str);
      return j;
    }
    else i = i+1;
  }
}



Measured memory_bytes: 16356
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int N, INF = 1000000000;
  cin >> N;
  vector< vector<int> > G(N,vector<int>(N));
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < N; ++j) cin >> G[i][j];
  }
  long long int ans = 0;
  for(int i = 0; i < N; ++i){
    for(int j = i+1; j < N; ++j){
      ans += min(G[i][j],G[j][i]);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int x, a;
    cin >> x >> a;
    if(x < a)
        cout << 0;
    else
        cout << 10;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int dx[]={0,1,0,-1,1,-1,-1,1};
const int dy[]={-1,0,1,0,1,1,-1,-1};
const int INF = 1<<30;
const double EPS = 1e-15;
#define PB push_back
#define mk make_pair
#define fi first
#define se second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
typedef pair<int,int> Pii;
typedef pair<int,Pii> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

vector < Pii > deleteList;
int H,W;
int stage[12][6];

bool check(){
	deleteList.clear();
	bool flg = false;
	rep(i,H){
		reps(j,1,W-1){
			if(stage[i][j-1] != 0 && stage[i][j-1] == stage[i][j] && stage[i][j] == stage[i][j+1]){
				deleteList.PB(Pii(i,j-1));
				flg = true;
			}
		}
	}
	return flg;
}

int deleteBlock(){
	int ret = 0;
	rep(i,deleteList.size()){
		reps(j,deleteList[i].se,deleteList[i].se+3){
			if(stage[deleteList[i].fi][j] > 0)ret += stage[deleteList[i].fi][j];
			stage[deleteList[i].fi][j] = -1;
		}
	}
	return ret;
}

void dropBlock(){
	rep(i,H){
		rep(j,W){
			if(stage[i][j] == -1){
				while(stage[i][j] == -1){
					reps(k,i+1,H){
						stage[k-1][j] = stage[k][j];
					}
					stage[H-1][j] = 0;
				}
			}
		}
	}
	return ;
}

void DEBUGPRINT(){
	
	rep(i,H){
		rep(j,W){
			printf("%2d%c",stage[i][j],j==W-1?'\n':' ');
		}
	}
	puts("######################");
}

int main(){
	W = 5;
	while(scanf("%d",&H),H){
		memset(stage,-1,sizeof(stage));
		rep(i,H){
			rep(j,W){
				scanf("%d",&stage[H-i-1][j]);
			}
		}
		int score = 0;
		while(check()){
			//DEBUGPRINT();
			score += deleteBlock();
			dropBlock();
		}
		
		printf("%d\n",score);
	}
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int total = 0;
    for (int i = 0; i < n; i++)
    {
        int l, r;
        cin >> l >> r;
        total += r - l + 1;
    }
    cout << total << endl;
}

Measured memory_bytes: 256