akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
//BEGIN CUT HERE
template <typename T,typename E>
struct SegmentTree{
  typedef function<T(T,T)> F;
  typedef function<T(T,E)> G;
  int n;
  F f;
  G g;
  T d1;
  E d0;
  vector<T> dat;
  SegmentTree(){};
  SegmentTree(int n_,F f,G g,T d1,
	      vector<T> v=vector<T>()):
    f(f),g(g),d1(d1){
    init(n_);
    if(n_==(int)v.size()) build(n_,v);
  }
  void init(int n_){
    n=1;
    while(n<n_) n*=2;
    dat.clear();
    dat.resize(2*n-1,d1);
  }
  void build(int n_, vector<T> v){
    for(int i=0;i<n_;i++) dat[i+n-1]=v[i];
    for(int i=n-2;i>=0;i--)
      dat[i]=f(dat[i*2+1],dat[i*2+2]);
  }
  void update(int k,E a){
    k+=n-1;
    dat[k]=g(dat[k],a);
    while(k>0){
      k=(k-1)/2;
      dat[k]=f(dat[k*2+1],dat[k*2+2]);
    }
  }
  inline T query(int a,int b){
    T vl=d1,vr=d1;
    for(a+=n,b+=n;a<b;a/=2,b/=2) {
      if(a&1) vl=f(vl,dat[(a++)-1]);
      if(b&1) vr=f(dat[(--b)-1],vr);
    }
    return f(vl,vr);
  }
  
};
//END CUT HERE
signed main(){
  int n,q;
  cin>>n>>q;
  SegmentTree<int,int> rmq(n,
			   [](int a,int b){return min(a,b);},
			   [](int a,int b){return b;},
			   INT_MAX);
  for(int i=0;i<q;i++){
    int c,x,y;
    cin>>c>>x>>y;
    if(c) cout<<rmq.query(x,y+1)<<endl;
    else rmq.update(x,y);
  }
  return 0;
}
/*
  verified on 2017/10/15
  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_A&lang=jp
*/

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

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

	lli n,qr,val[200010]={0},vis[200010]={0};
	vector<int> adj[200010];
	cin>>n>>qr;
	queue<lli> q;
	for (lli i=0;i<n-1;i++)
	{
		lli a,b;
		cin>>a>>b;
		adj[a].pb(b);
		adj[b].pb(a);
	}
	for (lli i=0;i<qr;i++){
		lli p,x;
		cin>>p>>x;
		val[p] += x;
	}
	// ans.pb(val[1]);
	q.push(1);
	vis[1]=1;
	while (!q.empty()){
		lli v = q.front();
		q.pop();
		for (auto i:adj[v]){
			if (!vis[i]) {q.push(i); vis[i]=1; val[i]+=val[v];}
		}
	}
	for (lli i=1;i<=n;i++)
		{cout<<val[i]<<" ";}
	cout<<endl;

	return 0;
}


Measured memory_bytes: 18676
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
    int n;
    while(cin>>n){
        int m;
        cin>>m;
        cout<<n*n-m<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
	string s;
	getline(cin,s);
	for (int i=0;i<s.size();i++)
	{
		if (s[i]==',')
			cout<<" ";
		else
			cout<<s[i];
	}
	cout<<endl;
	return 0;
} 

Measured memory_bytes: 256
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
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; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n;
int h[101];
int ans = 0;
bool flg;
int main(){
	cin >> n;
	REP(i, n){
		cin >> h[i];
	}
	REP(ttt, 100){
		REP(i, 100){
			if(h[i]){
				if(!flg){
					flg = true;
					ans++;
				}
				h[i]--;
			}
			else{
				flg = false;
			}
		}
		flg = false;
	}
	cout << ans << endl;
}

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

int main(){
  int N;
  int a[100];
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }
  
  sort(a, a+N, greater<int>());
  int Alice = 0;
  int Bob = 0;
  for(int i = 0; i < N; i++){
    if(i%2 == 0){
      Alice += a[i];
    }
    else{
      Bob += a[i];
    }
  }
  cout << Alice - Bob << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

struct State{
    int y,x,d;
};

const int N = 1000;
const int INF = 19191919;

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

int d[N][N][4];
vector<int> dir[4];



int main(){
    int h,w,n;
    while(cin >>h >>w >>n,h){
        // initialize
        rep(i,N)rep(j,N)rep(k,4) d[i][j][k]=INF;
        rep(i,4) dir[i].clear();

        string c;
        cin >>c;
        vector<string> f(h);
        rep(i,h) cin >>f[i];

        int nd = 0;
        rep(i,n){
            dir[nd].pb(i);
            if(c[i]=='L') nd = (nd+3)%4;
            else nd = (nd+1)%4;
        }
        dir[nd].pb(n);
        rep(i,4) dir[i].pb(INF);

        int sy,sx,gy,gx;
        rep(i,h)rep(j,w){
            if(f[i][j]=='S'){
                sy = i;
                sx = j;
            }
            if(f[i][j]=='G'){
                gy = i;
                gx = j;
            }
        }

        auto IN = [&](int y, int x){ return 0<=y && y<h && 0<=x && x<w; };

        queue<State> que;
        que.push({sy,sx,0});
        d[sy][sx][0] = 0;
        while(!que.empty()){
            State now = que.front();
            que.pop();

            if(now.y==gy && now.x==gx) break;

            int D = d[now.y][now.x][now.d];

            // 今向いてる方に進む
            int ny = now.y+dy[now.d], nx = now.x+dx[now.d];
            if(IN(ny,nx) && f[ny][nx]!='#'){
                if(d[ny][nx][now.d] > D){
                    d[ny][nx][now.d] = D;
                    que.push({ny,nx,now.d});
                }
            }

            rep(i,4)if(i!=now.d){
                int dd = *lower_bound(all(dir[i]), D);
                if(d[now.y][now.x][i] > dd){
                    d[now.y][now.x][i] = dd;
                    que.push({now.y,now.x,i});
                }
            }
        }

        int ans = INF;
        rep(i,4) ans = min(ans, d[gy][gx][i]);
        cout << (ans<INF?"Yes":"No") << endl;
    }
    return 0;
}



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

#define L (nod << 1)
#define R (L | 1)
#define smax(X, Y) ((X) > (Y) ? (X) : (Y))
#define smin(X, Y) ((X) < (Y) ? (X) : (Y))
#define N 200005

int n, q, lzy[4*N], d[N], sol[N];

struct lol{
    int t, s, x;
    bool operator<(const lol &aux)const{return (x < aux.x);}
} a[N];

int bs(int val){
    int ans = 0;
    for (int i=1<<17; i; i>>=1)
        if (ans + i <= q && d[ans+i] < val) ans += i;
    return ans + 1;
}

void upd(int nod, int st, int dr, int l, int r, int val){
    if (st >= l && dr <= r){
        lzy[nod] = val;
        return;
    }
    int mid = (st + dr) >> 1;
    if (l <= mid) upd(L, st, mid, l, r, val);
    if (r > mid) upd(R, mid+1, dr, l, r, val);
}

void build(int nod, int st, int dr){
    if (st == dr){
        sol[st] = (!lzy[nod] ? -1 : lzy[nod]);
        return;
    }
    int mid = (st + dr) >> 1;
    if (lzy[nod]){
        if (lzy[L]) lzy[L] = smin(lzy[L], lzy[nod]);
        else lzy[L] = lzy[nod];
        if (lzy[R]) lzy[R] = smin(lzy[R], lzy[nod]);
        else lzy[R] = lzy[nod];
    }
    build(L, st, mid);
    build(R, mid+1, dr);
}

int main(){
    //ios_base::sync_with_stdio(0); cin.tie(0);
    //ifstream cin ("test.in");
    cin >> n >> q;
    for (int i=1; i<=n; i++) cin >> a[i].s >> a[i].t >> a[i].x;
    sort(a+1, a+1+n);
    for (int i=1; i<=q; i++) cin >> d[i];
    for (int i=n; i; i--){
        int st = a[i].s - a[i].x, dr = a[i].t - a[i].x;
        st = bs(st); dr = bs(dr) - 1;
        if (dr < st) continue;
        //cout << a[i].x << ' ' << a[i].s << ' ' << st << ' ' << dr << '\n';
        upd(1, 1, q, st, dr, a[i].x);
    }
    build(1, 1, q);
    for (int i=1; i<=q; i++) cout << sol[i] << '\n';
    return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
const int INF = 2e9;
const int MOD = 1e9 + 7;

int main() {
   string s;
   cin >> s;
   int n = s.size();
   rep(i, 0, n) if ((i+1) % 2) cout << s[i];
   cout << endl;
   return 0;
}

Measured memory_bytes: 512
package main

import (
	"fmt"
	"math"
)

var dp = make([]int, int(math.Pow10(5))+1000)
var graph = make([][]int, int(math.Pow10(5))+1000)

func chmax(a *int, b int) bool {
	if *a < b {
		(*a) = b
		return true
	}
	return false
}

func rec(i int) int {
	if dp[i] != -1 {
		return dp[i]
	}

	var res int
	for _, nv := range graph[i] {
		chmax(&res, rec(nv)+1)
	}
	dp[i] = res
	return dp[i]
}

func main() {
	var N, M int
	fmt.Scan(&N, &M)

	var x, y int
	for i := 0; i < M; i++ {
		fmt.Scan(&x, &y)
		x--
		y--
		graph[x] = append(graph[x], y)
	}

	for i := range dp {
		dp[i] = -1
	}

	var res int
	for i := 0; i < N; i++ {
		chmax(&res, rec(i))
	}

	fmt.Println(res)
}

Measured memory_bytes: 15360
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define INF 1e9+7
#define rep(i,n) for(ll i=0;i<n;i++)
#define pii pair<int,int>
#define pll pair<ll,ll>
const int maxn = 100;
ll mod = INF;
int n;
int x[maxn];
int ans=INF;

int main(){
    cin >> n;
    rep(i,n)cin >> x[i];
    for(int i=1;i<=100;i++){
        int c=i;
        int temp=0;
        rep(j,n){
            temp+=(x[j]-c)*(x[j]-c);
        }
        ans=min(ans,temp);
    }
    cout << ans<<endl;
    return 0;
}

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

int main(){
    int N; cin >> N;
    long long a[N];
    long long cnt[N]={};
    for(int i=0;i<N;i++){
        cin >> a[i];
        a[i]--;
        cnt[a[i]]++;
    }
    long long ans=0;
    for(int i=0;i<N;i++){
        if(cnt[i]==0) continue;
        ans+=cnt[i]*(cnt[i]-1)/2;
    }
    for(int i=0;i<N;i++){
        cout << max(0LL,ans-max(0LL,cnt[a[i]]-1)) << endl;
    }


}

Measured memory_bytes: 5760
import Data.Maybe (fromJust)
import Data.List (elemIndex, sort)
import Data.List.Split (splitOn)

swapCups [o1, o2] [a, b, c]
    | o1 == "A" && o2 == "B" = [b, a, c]
    | o1 == "A" && o2 == "C" = [c, b, a]
    | o1 == "B" && o2 == "C" = [a, c, b]

findBall cs
    | i == 0 = "A"
    | i == 1 = "B"
    | i == 2 = "C"
        where i = fromJust $ elemIndex 1 cs

main :: IO ()
main = putStrLn . findBall . foldr swapCups [1, 0, 0] . reverse . map sort . map (splitOn ",") . lines =<< getContents

Measured memory_bytes: 3672
import java.io.*;
import java.util.*;
//import java.util.Map.Entry;
//import java.util.stream.*;
//import java.math.*;

public class Main {

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        long MOD = (long) (Math.pow(10, 9) + 7);
        int n = sc.nextInt();
        int array[] = new int[n];
        forl_0(n, array, sc);
        Arrays.sort(array);
        int i = 0;
        int count = 0;
        int nx = 0;
        while (i < n) {
            int num = array[i];
            nx = 0;
            while (i < n && array[i] == num) {
                i++;
                nx++;
            }
            count += nx % 2;
        }
        System.out.println(count);
        bw.flush();
    }
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//

    static class Pair implements Comparable<Pair> {

        int a, b;

        public Pair(int x, int y) {
            a = x;
            b = y;
        }

        @Override
        public int compareTo(Pair p) {
            return a - p.a;
        }
    }

    static void forl_0(int n, int[] array, Scanner sc) {
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
    }

    static void forl_1(int n, int[] array, Scanner sc) {
        for (int i = 1; i <= n; i++) {
            array[i] = sc.nextInt();
        }
    }

    static void two_d(int n, int m, int[][] array, Scanner sc) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                array[i][j] = sc.nextInt();
            }
        }
    }

    static boolean isPrime(long n) {
        if (n < 2) {
            return false;
        } else if (n == 2 || n == 3) {
            return true;
        } else if (n % 2 == 0 || n % 3 == 0) {
            return false;
        }
        long sqrtN = (long) Math.sqrt(n) + 1;
        for (long i = 6L; i <= sqrtN; i += 6) {
            if (n % (i - 1) == 0 || n % (i + 1) == 0) {
                return false;
            }
        }
        return true;
    }

    public static long gcd(long a, long b) {
        return (b == 0) ? a : gcd(b, a % b);
    }

    public static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
    }
}


Measured memory_bytes: 59700
import java.util.*;
public class Main {
	public static void main(String[] args) {
		int n, sum = 0;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		for(int i = 1; i <= n; i++)
		{
		sum += i;
		}
		System.out.println(sum);
	}
 
}

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


int main() {
  int n;
  cin >> n;
 int a[n];
  int max = -1;
  int count = 0;
  for(int i = 0;i < n;i++){
    cin >> a[i];
    //cout <<i <<endl;
   if(a[i] >= max){
   max = a[i];
   count++;
  
    }
  }

cout << count << endl;
}

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



int main() {
	int N;
	double ans=0;
	cin >> N;
	vector<double> vec(N);
	rep(i, N) {
		cin >> vec[i];
	}
	sort(vec.begin(), vec.end());
	rep(i, N) {
		int p = N - i;
		if (i==0 || i==1)
		{
			p = N - 1;
			
		}
		ans += vec.at(i) * pow(0.5,p);
	}
	cout << ans << endl;
}

Measured memory_bytes: 4192
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll dp[101][100001];
int main() {
	// your code goes here
	ll n,W;
	cin>>n>>W;
	vector<ll> w(n+1),v(n+1);
	/*
	State
	dp[i][j]: Denotes the minimum weight of items(from 1 to i) picked in the bag having total value == j
	Recurrence
	2 choices 1: we pick the ith element, 2: we dont pick the ith element 
	The 2 choices are checked for all weights
	dp[i][j]=minimum(weight of items picked from 1 to i-1 with value == j,weight of items picked from 1 to i-1 with value == (j-value[i]) + weight[i])
	*/
	for(ll i=1;i<=n;i++)
	cin>>w[i]>>v[i];
	ll ans=0,val=1e5;
    for(ll i=0;i<=n;i++){
        for(ll j=0;j<=1e5;j++)
            dp[i][j] = 1e10;
    }
	for(ll i=0;i<=n;i++){
        dp[i][0] = 0;
    }
	for(ll i=1;i<=n;i++){
		for(ll j=0;j<=val;j++){
			if(v[i]>j)
				dp[i][j]=dp[i-1][j];
			else
				dp[i][j]=min(dp[i-1][j],dp[i-1][j-v[i]]+w[i]);
			if(dp[i][j]<=W && dp[i][j]>0)
				ans=max(ans,j);
		}
	}
	cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 79104
#!/usr/bin/env python
# coding: utf-8

# In[1]:


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


# In[2]:


mylist = sorted(rgbn[:3], reverse=True)
ans = 0
for i in range(rgbn[3]//mylist[0] + 1):
#     print(i)
    for j in range((rgbn[3] - mylist[0]*i)//mylist[1] + 1):
#         print(i,j)
        rest = (rgbn[3] - mylist[0]*i - mylist[1]*j)
        if rest%mylist[2] == 0:
#             print(i,j,rest//mylist[2])
            ans += 1
print(ans)


# In[ ]:






Measured memory_bytes: 3060
import sys
class alphabet: #Trueなら大文字
    def __init__(self, capitalize):
        self.num = dict()
        self.index = dict()
        self.abc = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"\
            ,"o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
        if capitalize: 
            for i in range(26): self.abc[i] = self.abc[i].upper()
        for i, a in enumerate(self.abc):
            self.num[a] = i
            self.index[i] = a

def solve():
    input = sys.stdin.readline
    N = int(input())
    S = input().strip("\n")
    AB = alphabet(False)
    Count = [1] * 26
    for i in range(len(S)):
        Count[AB.num[S[i]]] += 1
    mod = 7 + 10 ** 9
    Ans = 1
    for i, n in enumerate(Count):
        Ans *= n
        Ans %= mod
    print((Ans - 1 + mod) % mod)


    return 0

if __name__ == "__main__":
    solve()

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

int main() {
	// your code goes here
	int n,k;
	cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    int sum=0;
    for(int i=0;i<k;i++)  sum+=a[i];
    cout<<sum<<endl;
return 0;
}


Measured memory_bytes: 3632
import java.util.Scanner;
     
    public class Main{
      static int n,T,sum,x;
      static int[] tn;
     
      public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
     
        n = sc.nextInt();
        T = sc.nextInt();
        tn = new int[n];
        for(int i = 0; i < n; i++){
          tn[i] = sc.nextInt();
        }
     
        for(int i = 0; i < n; i++){
          if(i<n-1){
          x = tn[i+1]-tn[i];
          }
          if(x < T && i != n-1){
            sum += x;
          }
          else{
            sum += T;
          }
        }
     
        System.out.println(sum);
      }
    }

Measured memory_bytes: 64052
import java.util.Scanner;

public class Main {

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

        String s;
        s = sc.nextLine();
        int i=0;

        char[] c;
        c = new char[s.length()];

        for (i = 0; i < s.length(); ++i) {

            c[i] = s.charAt(i);

            if (s.charAt(i) <= 90 && s.charAt(i) >= 65) {
                c[i] += 32;
            } else if ((s.charAt(i) <= 122 && s.charAt(i) >= 97)) {
                c[i] -= 32;
            }
        }
        for (i = 0; i < s.length(); ++i){
                System.out.print(c[i]);
        }
        System.out.println();
    }
}



Measured memory_bytes: 27128
N = int(input())
A = [int(i) for i in input().split()]

counts = [0]*9

for i in A:
    color = int(i/400)
    if color > 8:
        color = 8
    counts[color] += 1

#print(counts)

v = 8 - counts[:-1].count(0)

if counts[-1] == 0:
    print(v,v)
else:
    if v == 0:
        print(1,counts[-1])
    else :
        print(v,v+counts[-1])

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


int main(){
    int k,x;
    cin>>k>>x;
    if(k*500>=x){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>

#define f(i,x) for(int i=0;i<x;i++)


using namespace std;

int main()
{
	string a, b, c;
	cin >> a >> b >> c;
	cout << a[0] << b[0] << c[0];
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        Map<Character, Integer> dic = new HashMap<>();
        String w = in.next();
        for (int i = 0; i < w.length(); i++){
            if (dic.containsKey(w.charAt(i))){
                dic.put(w.charAt(i), dic.get(w.charAt(i)) +1);
            }
            else {
                dic.put(w.charAt(i), 1);
            }
        }
        for (Character c: dic.keySet()){
            if (dic.get(c) %2 != 0){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 21844
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<stdlib.h>
#include<queue>
#include<map>
#include<set>
#include<time.h>
#include<memory>
#include<algorithm>
#define M_PI 3.14159265358979323846
#define ll long long
#define int ll
#define E exp(1.0)
const int N = 1 << 22;
using namespace std;
ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
template<class T>
T MIN(const T& a, const T& b) {
	return a < b ? a : b;
}
template<class T>
T MAX(const T& a, const T& b) {
	return a > b ? a : b;
}
int bit[N + 1];
void update(int pos, int val) {
	while (pos <= N) {
		bit[pos] += val;
		pos += pos & (-pos);
	}
}
int bsearch(int x) {
	if (x == 0) return 0;
	int pos = 0;
	for (int i = N / 2; i >= 1; i >>= 1) {
		if (bit[i + pos] < x) {
			x -= bit[i + pos];
			pos += i;
		}
	}
	return  pos + 1;
}
int getsum(int pos) {
	int sum = 0;
	while (pos > 0) {
		sum += bit[pos];
		pos -= pos & (-pos);
	}
	return sum;
}
signed main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	cout << a * b << endl;
	return 0;
}

Measured memory_bytes: 3164
from sys import stdin


def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    a, b, c, d = list(map(int, _in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = -float('inf')
    cnt = max(cnt, a * c)
    cnt = max(cnt, a * d)
    cnt = max(cnt, b * c)
    cnt = max(cnt, b * d)
    ans = cnt
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(ans)


if __name__ == "__main__":
    main()


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

int main(){
  int m,n;
  while(cin >> n >> m,n){
    vector<string> cv;
    vector<string> nv;
    vector<int> iv;
    for(int i=0; i<n; ++i){
      string tmp;
      int num;
      cin >> tmp >> num;
      cv.push_back(tmp);
      iv.push_back(num);
    }                               
    for(int i=0; i<m; ++i){
      string tmp;
      cin >> tmp;
      nv.push_back(tmp);
    }
    int ans = 0;
    for(int i=0; i<n; ++i){
      for(int j=0; j<m; ++j){
        bool frg = true;
        for(int k=0; k<8; ++k){
          if(cv[i][k]!='*' && cv[i][k]!=nv[j][k]){frg = false;}
        }
        if(frg){ans+=iv[i];}
      }
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
int INF = 1000000007;


double ans = 0;
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  int N, K;
  cin >> N >> K;
  int A[N];
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  int64_t dp[N];
  for(int i=0;i<N;i++){
    dp[i] = INF;
  }
  dp[0] = 0;
  dp[1] = abs(A[1] - A[0]);
  for(int i=2;i<N;i++){
    for(int j=max(0, i-K);j<i;j++){
      dp[i] = min(dp[i], dp[j] + abs(A[i]- A[j]));
    }
  }
  cout << dp[N-1] << endl;
}

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



void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}


int gcd(int a, int b){
  int c;

  while (b > 0){
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

long int modpow(long int a,long int n,long int mod){
  long int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}

int main(void){
  long int h,w;
  scanf("%ld%ld",&h,&w);
  long int odd,even;
  if(h%2==0){
    odd=h/2;
    even=h/2;
  }else{
    odd=(h+1)/2;
    even=h/2;
  }
  long int ans=0;
  ans+=(w/2)*odd+(w/2)*even;
  if(w%2==1){
    ans+=odd;
  }
  if(h==1||w==1){
    ans=1;
  }
  printf("%ld\n",ans);
  return 0;
}

Measured memory_bytes: 1720
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e15;

int n;
string s;

vector<int> split(const string &s,char c=' '){
    vector<int> ret;
    stringstream ss(s);
    string t;
    while(getline(ss,t,c)){
        ret.push_back((int)t.size());
    }
    return ret;
}

vector<vector<int> > split_vector(vector<int> &a, int pivot){
    vector<vector<int> > res;
    a.push_back(pivot);
    for(int i = 0; i < a.size(); i++){
        vector<int> tmp;
        while(i < a.size() && a[i] != pivot){
            tmp.push_back(a[i++]);
        }
        if(tmp.size() > 1) res.push_back(tmp);
    }
    a.pop_back();
    return res;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int ans = 0;
    cin >> n >> s;
    vector<int> a = split(s, '0');
    vector<vector<int> > b = split_vector(a, 0);
    rep(i, 0, b.size()){
        // for(int ii = 0; ii < b[i].size(); ii++){
        //     if(ii) cout << ' ';
        //     cout << b[i][ii];
        // }
        // cout << endl;
        int dp[4] = {}, next[4] = {};
        dp[0] = dp[1] = dp[2] = -1;
        dp[3] = 0;
        rep(j, 0, b[i].size() - 1){
            rep(k, 0, 4) next[k] = -1;
            rep(k, 0, 4){
                if(dp[k] == -1) continue;
                chmax(next[3], dp[k]);
                if(k == 0) continue; 
                int rest = b[i][j];
                if(k == 1) rest = 1;
                if(k == 2) rest--;
                chmax(next[2], dp[k] + rest);
                if(rest != 0){
                    chmax(next[0], dp[k] + b[i][j + 1]);
                    chmax(next[1], dp[k] + b[i][j + 1] - 1);
                }
            }
            swap(dp, next);
        }
        ans += max({dp[0], dp[1], dp[2], dp[3]});
    }
    cout << ans << endl;
}

Measured memory_bytes: 7956
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// 最大公約数(ユークリッドの互除法)
// O(log max(a, b))
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a%b);
}

// 約数全列挙  O(√n)
vector<ll> divisor(ll n){
    vector<ll> ret;
    for(ll i = 1; i*i <= n; i++){
        if(n % i == 0)  {
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}

int main(){
    int n, a, b, c, g;
    cin >> n;
    if(n == 2){
        cin >> a >> b;
        g = gcd(a, b);
        vector<ll> res = divisor(g);
        rep(i, res.size()) cout << res.at(i) << endl;
    }
    if(n == 3){
        cin >> a >> b >> c;
        g = gcd(a, gcd(b, c));
        vector<ll> res = divisor(g);
        rep(i, res.size()) cout << res.at(i) << endl;
    }
}


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

int main() {
	// your code goes here
	int n,temp=0;
	cin>>n;
	long arr[n];
	for(int i=0;i<n;i++){
		cin>>arr[i];
		temp+=arr[i];
	}
	long cases;
	cin>>cases;
	while(cases--){
		long a,b;
		cin>>a>>b;
		long sum = temp - arr[a-1] + b;
		cout<<sum<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
  }
}init;

int main(){
  int N;
  while(cin >> N){
    vector<int> L(N); cin >> L;
    sort(ALL(L));

    LLI ans = 0;

    REP(i,N){
      FOR(j,i+1,N){
        FOR(k,j+1,N){
          int a = L[i], b = L[j], c = L[k];
          if(a < b+c and b < a+c and c < a+b){
            ++ans;
          }else{
            break;
          }
        }
      }
    }


    cout << ans << endl;    
  }

  return 0;
}


Measured memory_bytes: 256
use std::char;

#[allow(unused_macros)]
macro_rules ! read_value {($ next : expr , ($ ($ t : tt ) ,* ) ) => {($ (read_value ! ($ next , $ t ) ) ,* ) } ; ($ next : expr , [$ t : tt ; $ len : expr ] ) => {(0 ..$ len ) . map (| _ | read_value ! ($ next , $ t ) ) . collect ::< Vec < _ >> () } ; ($ next : expr , chars ) => {read_value ! ($ next , String ) . chars () . collect ::< Vec < char >> () } ; ($ next : expr , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
#[allow(unused_macros)]
macro_rules ! input_inner {($ next : expr ) => {} ; ($ next : expr , ) => {} ; ($ next : expr , $ var : ident : $ t : tt $ ($ r : tt ) * ) => {let $ var = read_value ! ($ next , $ t ) ; input_inner ! {$ next $ ($ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input {(source = $ s : expr , $ ($ r : tt ) * ) => {let mut iter = $ s . split_whitespace () ; let mut next = || {iter . next () . unwrap () } ; input_inner ! {next , $ ($ r ) * } } ; ($ ($ r : tt ) * ) => {let stdin = std :: io :: stdin () ; let mut bytes = std :: io :: Read :: bytes (std :: io :: BufReader :: new (stdin . lock () ) ) ; let mut next = move || -> String {bytes . by_ref () . map (| r | r . unwrap () as char ) . skip_while (| c | c . is_whitespace () ) . take_while (| c |! c . is_whitespace () ) . collect () } ; input_inner ! {next , $ ($ r ) * } } ; }

#[allow(dead_code)]
fn adjacent8(y: usize, x: usize, sy: usize, sx: usize) -> impl Iterator<Item = (usize, usize)> {
    [
        (0, 1),
        (1, 1),
        (1, 0),
        (1, -1),
        (0, -1),
        (-1, -1),
        (-1, 0),
        (-1, 1),
    ]
    .iter()
    .filter_map(move |&(dy, dx)| {
        let yi = y as isize + dy;
        let xi = x as isize + dx;
        if yi >= 0 && yi < sy as isize && xi >= 0 && xi < sx as isize {
            Some((yi as usize, xi as usize))
        } else {
            None
        }
    })
}

fn main() {
    input! {
        h: usize,
        w: usize,
        s_: [String; h],
    }
    let s: Vec<Vec<char>> = s_.iter().map(|e| e.chars().collect::<Vec<_>>()).collect();

    let mut ret = vec![vec!['#'; w]; h];
    for i in 0..h {
        for j in 0..w {
            if s[i][j] == '#' {
                continue;
            }
            let num = adjacent8(i, j, h, w).filter(|(y, x)| {
                s[*y][*x] == '#'
            }).count();
            ret[i][j] = char::from_digit(num as u32, 10).unwrap();
        }
    }

    for i in 0..h {
        println!("{}", ret[i].iter().collect::<String>());
    }
}


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

using namespace std;

int main(void) {
    long n, m;
    cin >> n >> m;

    vector<vector<int>> G(n);

    int s = 0;
    for(int i=0; i<m; i++) {
        int a,b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
        s = a;
    }
    int ss = s;

    vector<int> res = {s};
    set<int> st; st.insert(s);

    while(1) {
        for(auto v: G[s]) {
            if(st.count(v)) continue;
            s = v;
            res.push_back(s);
            st.insert(s);
            goto nxt;
        }
        break;
nxt:
        ;
    }

    vector<int> ser;
    s = ss;
    while(1) {
        for(auto v: G[s]) {
            if(st.count(v)) continue;
            s = v;
            ser.push_back(s);
            st.insert(s);
            goto nxt2;
        }
        break;
nxt2:
        ;
    }

    cout << ser.size() + res.size() << endl;
    reverse(ser.begin(), ser.end());
    for(auto x: ser) cout << x+1 << endl;
    for(auto x: res) cout << x+1 << endl;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

void dfs(int pos, int spos);
string s;
int N;

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

    cin >> s;
    N = s.size();

    if(s[0] == '0' || s[N - 1] == '1') {
        cout << -1 << endl;
        return 0;

    }

    for(int i = 1; i < N; ++i) {
        if(s[i - 1] != s[N - i - 1]) {
            cout << -1 << endl;
            return 0;

        }
    }

    reverse(all(s));
    dfs(1, 1);
    return 0;
}

void dfs(int pos, int spos) {
    if(spos == N) return;

    int tmp = pos;
    ++pos;
    while(spos < N && s[spos] == '0') {
        cout << tmp << " " << pos << endl;
        ++spos;
        ++pos;

    }
    cout << tmp << " " << pos << endl;
    dfs(pos, spos + 1);

    return;
}



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

int main(){
   string  s;
   cin >> s;
   int cost = 700;
   if(s[0] == 'o') cost += 100;
   if(s[1] == 'o') cost += 100;
   if(s[2] == 'o') cost += 100;
   cout << cost << endl;
   return 0;
}

Measured memory_bytes: 256
def yakusu(x):
    ans=0
    for i in range(x+1):
        if i%2==0:
            continue
        cnt=0
        for j in range(1,i+1):
            if i%j==0:
                cnt+=1

        if cnt==8:
            ans+=1
    print(ans)

yakusu(int(input()))


Measured memory_bytes: 2940
#include <iostream>

using namespace std;

int main(){
  int p,q;

  while(cin >> p >> q){ 
    int Quo[100],Rem[100];    
    bool flg = false;
    int begin,end,t = 0;

    for(int i = 0 ; i < 100 ; i++ ,t++){
      p *= 10;
      Quo[i] = p / q;
      Rem[i] = p % q;
      p %= q;

      for(int j = 0 ; j < i ; j++){
	if(Quo[i] == Quo[j] && Rem[i] == Rem[j]){
	  begin = j;
	  end = i;
	  goto end;
	}
      }
      
      if(!p){
	flg = true;
	break;
      }
    }
  end:

    if(flg){
      for(int i = 0 ; i <= t ; i++){
	cout << Quo[i];
      }
      cout << endl;
    } else {
      for(int i = 0 ; i < t ; i++){
	cout << Quo[i];
      }
      cout << endl;
   
      for(int i = 0 ; i < begin ; i++) cout << " ";
      for(int i = begin ; i < end ; i++) cout << "^"; 
      cout << endl;
    }    
  }

  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#define Rep(i,a) for(int i = 0; i < (a); i++)
#define rep(i,a,b) for(int i = (a); i <= (b); i++)//(a)!
#define dep(i,a,b) for(int i = (a); i >= (b); i--)
#define ab(a) ((a) > 0 ? (a) : -(a))
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a)
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
const int N = 3010, mod = 1000000000 + 7;
char s[N], t[N];
int f[N][N];
int main() {
	int n, m; scanf("%d%d",&n,&m);
	scanf("%s",s + 1); rep(i,1,n) t[i] = s[i];
	rep(j,1,m) {
		int l, r; scanf("%d%d",&l,&r);
		int c = 0; rep(i,l,r) if (s[i] == '0') c++;
		rep(i,l,l+c-1) s[i] = '0'; rep(i,l + c,r) s[i] = '1';
		c = 0; rep(i,l,r) if (t[i] == '1') c++;
		rep(i,l,l+c-1) t[i] = '1'; rep(i,l + c,r) t[i] = '0';
	}
	f[0][0] = 1; int cnt_s = 0, cnt_t = 0;
	rep(i,1,n) {
		cnt_s += s[i] - '0', cnt_t += t[i] - '0';
		rep(j,0,i) if (cnt_s <= j && j <= cnt_t) {
			f[i][j] = f[i - 1][j]; if (j) ( f[i][j] += f[i - 1][j - 1] ) %= mod;
		}
	}
	cout <<f[n][cnt_s] % mod<<endl;
	return 0;
}

Measured memory_bytes: 12416
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>
#include <stack>
#include <tuple>
#include <array>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)


typedef long long int ll;
typedef double D; // ???§??¨?????????????double???long double?????????
typedef complex<D> P; // Point
typedef pair<P, P> L; // Line
typedef vector<P> VP;


const int INF = (1<<30) - 1;
const D EPS = 1e-9;

#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

string S;

string dfs(int s, int t){
    string ret = "";
    
    while(s<t){
        char c = S[s];
        if(c == '['){
            int count = 0;
            for(int i=s; i<t; i++){
                if(S[i] == '[') count++;
                if(S[i] == ']') count--;
                if(count == 0){
                    string tret = dfs(s+1, i);
                    reverse(tret.begin(), tret.end());
                    ret += tret;
                    s = i;
                    break;
                    }
                }
            }else{
                int count = 0;
                while(S[s] == '+' || S[s] == '-'){
                    if(S[s] == '+')
                        count++;
                    else if(S[s] == '-')
                        count--;
                    s++;
                    }
                ret += ((S[s]-'A'+count)%26+26)%26 + 'A';
                }
        s++;
        }
    
    return ret;
}

void solve(){
    vector<int> rewrite;
    for(int i=0; i<S.length(); i++) if(S[i] == '?')
        rewrite.push_back(i);
    
    string ans = "";
    for(int i=0; i<26; i++){
        for(int j=0; j<26; j++){
            for(int k=0; k<26; k++){
                if(0 < rewrite.size())
                    S[rewrite[0]] = 'A'+i;
                if(1 < rewrite.size())
                    S[rewrite[1]] = 'A'+j;
                if(2 < rewrite.size())
                    S[rewrite[2]] = 'A'+k;
                
                string tans = dfs(0, S.length());
                if(ans == "" || tans < ans)
                    ans = tans;
                }
            }
        }
    cout << ans << endl;
}

//g++ -std=c++0x -msse4.2 -O3
//#include <bits/stdc++.h>
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout.precision(16);
    
    while(cin>>S, S!=".")
        solve();
    
    return 0;
}

Measured memory_bytes: 1212
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
            double r = sc.nextDouble();
            
            double x = r * r * 3.141592653589;
            double y = 2 * r * 3.141592653589;
            System.out.println((String.format("%.6f", x)) + " " + (String.format("%.6f", y)));
            
    }
}


Measured memory_bytes: 28464
#include<bits/stdc++.h>
using namespace std;
int main() {
  int x, l, n;
  pair<int, int> itv[100000];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> l;
    itv[i].first = x + l;
    itv[i].second = max(x - l, 0);
  }
  sort(itv, itv + n);
  int ans = 1, t = itv[0].first;
  for (int i = 1; i < n; i++) {
    if (t <= itv[i].second) {
      ans++;
      t = itv[i].first;
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <utility>
#include <string>
#include <set>
#include <vector>

using namespace std;

int main() {
  long int n = 0;
  cin >> n;
  if(n==0) {
    cout << 0 << endl;
    return 0;
  }
  vector <long long int> a(n);
  vector <long long int> b(n);

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

  }

  long long int push = 0;
    for(int i = n-1; i>=0; i--) {
      long long int plus = b[i] - (a[i]+push)%b[i];
      if(plus==b[i]) plus = 0;
      else{
        push += plus;
      }
    }

  cout << push << endl;

  return 0;

}

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

int main(){
    long X,cash = 100;
    cin >> X;
    
    int years=1;
    while(1){
        cash *= 1.01;
        if(cash >= X){
            cout << years << endl;
            break;
        }
        years++;
    }

    return 0;
}

Measured memory_bytes: 3636
N = int(raw_input())
points = [int(raw_input()) for i in range(N)]
points.sort(reverse=True)
ans = sum(points)

while (ans % 10 == 0):
    min = points.pop()
    if min % 10 != 0:
        ans -= min
    if len(points) == 0:
        break

print ans if ans % 10 != 0 else 0


Measured memory_bytes: 2568
#include <iostream>

using std::cin;
using std::cout;

int main() {
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++) {
		if(i % 3 == 0) cout << ' ' << i;
		else {
			int j = i;
			bool got = 0;
			while(j) {
				got = j % 10 == 3;
				j /= 10;
				if(got) break;
			}
			if(got) cout << ' ' << i;
		}
	}
	cout << '\n';
	return 0;
}


Measured memory_bytes: 3112
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<tuple>
#include<set>


#define MOD 1000000007
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back

typedef long long ll;

using namespace std;

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

int main(){
    ll N;
    cin>>N;
    vector<ll> P(N);
    rep(i,0,N)cin>>P[i];
    rep(i,0,N)P[i]--; //0-index
    
    vector<ll> place(N);
    rep(i,0,N)place[P[i]]=i;

    set<ll> visited;
    vector<ll> l(2,-1),r(2,N);

    ll cnt=0;
    ll ans=0;
    for(int i=N-1;i>=0;i--){
        cnt=0;
        l[0]=-1;l[1]=-1;r[0]=N;r[1]=N;
        visited.insert(place[i]);
        auto it=visited.find(place[i]);

        rep(j,0,2){
            if(it==visited.begin())break;
            it--;
            l[j]=*it;
        }
        it=visited.find(place[i]);

        rep(j,0,2){
            it++;
            if(it==visited.end())break;
            r[j]=*it;
        }

        cnt+=(ll)((l[0]-l[1])*(r[0]-place[i])*(i+1));
        cnt+=(ll)((r[1]-r[0])*(place[i]-l[0])*(i+1));
        ans+=cnt;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 6528
/*
	Failure is not the reason for you to stop trying 
	   it is actually a remainder that you should 
			KEEP GOING 
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define SaveTime ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define E endl
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 1e6+5;
const int INF = 1e18L;
int ar[N];
int dp[N];
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	SaveTime;
	int T=1;
	// cin >> T;
	while(T--){
		int n;
		cin >>n;
		vector<int>a,b,aa,bb;
		fn{
			int x;
			cin>>x;
			a.pb(x);
			aa.pb(x);
		}
		fn{
			int x;
			cin>>x;
			b.pb(x);
			bb.pb(x);
		}
		sort(all(aa));
		sort(all(bb));
		int x  ,y;
		x  = y = 0;
		do{
			x++;
			if(aa==a){
				break;
			}


		}while(next_permutation(all(aa)));
	
		do{
			y++;
			if(bb==b){
				break;
			}


		}while(next_permutation(all(bb)));
		cout <<abs(x-y)<<endl;	
	}
	
	cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
using ll = long long ;
ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}
using namespace std;

int main(){
    string s;
    cin >> s;
    int ans = 0;
    int zero = count(all(s),'0');
    int one = count(all(s),'1');
    cout << 2*min(zero,one) << endl;
    
}

Measured memory_bytes: 512