akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
typedef pair<int,int> P;
#define INF 1e9
#define rep(i,N) for(int i=0;i<N;i++)

double ans = 0;
double tmp = 0;
double vM[1000005];

int main(){
  ll n,k;
  cin>>n>>k;
  rep(i,n){
    double p;
    cin>>p;
    vM[i] = double(double((1 + p) * (p)) / 2);
    vM[i] /= p;
  }

  rep(i,n){
    tmp += vM[i];
    if( i < k ){
      ans = tmp;
    }else{
      tmp -= vM[i-k];
      if(tmp > ans){
        ans = tmp;
      }
    }
  }
  
  cout<<setprecision(10)<<ans<<endl;

}

Measured memory_bytes: 1792
#include<iostream>
#include<queue>
#include<utility>
#include<vector>
using namespace std;
typedef pair<int, int> P;

const int MAX_N = 1e5 + 1;
const int MAX_M = 2 * 1e5 + 2;

bool is_checked[MAX_N];
int parent[MAX_N], dist[MAX_N];
vector<P> graph[MAX_N];

bool bfs(int root) {
    queue<P> Q;
    Q.push(P(root, 0));
    while (!Q.empty()) {
        P now = Q.front();
        Q.pop();
        int node = now.first, cost = now.second;
        if (dist[node] == 0) dist[node] = cost;
        else if (dist[node] != cost) {
            return false;
        }
        if (is_checked[node]) continue;
        is_checked[node] = true;
        for (int i = 0; i < graph[node].size(); i++) {
            if (is_checked[graph[node][i].first]) {
                if (dist[graph[node][i].first] != graph[node][i].second + cost) {
                    return false;
                }
            }
            else Q.push(P(graph[node][i].first, graph[node][i].second + cost));
        }
    }
    return true;
}

int main() {
    int N, M, L, R, D;
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        cin >> L >> R >> D;
        parent[R] = L;
        graph[L].push_back(P(R, D));
    }
    for (int i = 1; i <= N; i++) {
        if (parent[i] == 0 && !is_checked[i]) {
            if (!bfs(i)) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    for (int i = 1; i <= N; i++) {
        if (!is_checked[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 7040
#include <iostream>
#include <utility>

#define INPUT_FROM_FILE (0)

#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif // INPUT_FROM_FILE
	int n = 0;
	int x = 0;

#if INPUT_FROM_FILE
	while(ifs >> n >> x, (n != 0 || x != 0)){
#else
	while(std::cin >> n >> x, (n != 0 || x != 0)){
#endif
		int result = 0;
		for(int i = 1; i < n; i++){
			for(int j = i + 1; j < n; j++){
				int k = x - i - j;
				if(k > j && k <= n){
					result++;

					//dbg
					//std::cout << i << " + " << j << " + " << k << std::endl;
				}
			}
		}
		std::cout << result << std::endl;
	}
	return 0;
}

Measured memory_bytes: 3076
a,b = map(int,input().split())
L = list(map(int,input().split()))
L.sort()
if b == 0:
    print("No")
    exit()
if b==1 and L[0]<a:
    print("No")
    exit()

if sum(L) >= a: 
    print("Yes")
else:
    print("No")

Measured memory_bytes: 13964
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
int main() {
  int n,p=0,q=0;
  cin>>n;
  vector<int> a(n),b;
  rep(i,n) cin>>a[i];
  for(int i=1;i<=n-1;i++){
    for(int j=0;j<n;j++){
      if(j<i){
        p+=a[j];
      }else{
        q+=a[j];
      }
    }
    b.push_back(abs(p-q));
    p=0;
    q=0;
  }
  sort(b.begin(),b.end());
  cout<<b[0]<<endl;
}


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

int main(){
  string S;
  cin >> S;
  string rS = S;
  reverse(rS.begin(), rS.end());
  int hug = 0;
  
  for (int i = 0; i < S.size() / 2; i++) {
    if (S.at(i) == rS.at(i)) {
      continue;
    } else {
      hug++;
    }
  }
  
  cout << hug << endl;
  
  
  return 0;
    
    
  
  
  
}
  

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

int main(){
    int x ;
    int i=1 ;
    
    while(1){
        cin >> x ;
        
        
        if( x == 0) break;
        else cout << "Case" << " " << i++ <<  ":" << " " << x << endl;
        
                
    }
    return 0;
    
}

Measured memory_bytes: 3044
h, w = map(int, input().split())
S = [list(input()) for _ in range(h)]
drc = [[0,1],[0,-1],[1,0],[-1,0]]
for i in range(h):
  for j in range(w):
    if S[i][j] == "#":
      if all([S[i+y][j+x] == "." for x, y in drc if (0 <= j+x < w) and (0 <= i+y < h)]):
        print("No")
        exit()
print("Yes")

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

typedef long long ll;

ll gcd(ll a, ll b) {
  if (b == 0) {
    return a;
  }
  else {
    return gcd(b, a%b);
  }
}

ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return a/g*b;
}

int main() {
  int n;
  cin >> n;
  vector<ll> t(n);
  for (int i = 0; i < n; i++) {
    cin >> t[i];
  }
  sort(t.rbegin(), t.rend());
  ll ans = 1LL;
  for (int i = 0; i < n; i++) {
    ans = lcm(ans, t[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
N,M=input().split()
N=int(N)
M=int(M)
A=[int(x) for x in input().split()]
i=0
sum_A=0
result=0
if (1<=N<=10**6)and(1<=M<=10**4):
    for i in range(0,M):
        if 1<=A[i]<=10**4:
            sum_A+=A[i]
            i+=1
    result=N-sum_A
    if result<0:
        print(-1)
    else:
        print(result)

Measured memory_bytes: 10120
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] G = new int[n][n];
		
		for (int i = 0; i < n; i++) {
			int u = sc.nextInt();
			int k = sc.nextInt();
			for (int j = 0; j < k; j++) {
				int v = sc.nextInt();
				G[u][v] = sc.nextInt();
			}
		}
		solve1(n, G);
	}
	
	public static void solve1(int n, int[][] G) {
		int[] dist = new int[n];
		int[] cand = new int[n];
		Arrays.fill(dist, -1);
		Arrays.fill(cand, Integer.MAX_VALUE);
		dist[0] = 0;
		
		int s = 0;
		int count = n;
		while(count > 0) {
			for (int i = 0; i < n; i++) {
				if (G[s][i] == 0)
					continue;
				cand[i] = Math.min(G[s][i] + dist[s], cand[i]);
			}
			
			int minI = s;
			int minD = Integer.MAX_VALUE;
			for (int i = 0; i < n; i++) {
				if (dist[i] < 0 && cand[i] < minD) {
					minI = i;
					minD = cand[i];
				}
			}
			if (minI != s) {
				dist[minI] = minD;
				s = minI;
			}
			count--;
		}
		for (int i = 0; i < n; i++) {
			System.out.println(i + " " + dist[i]);
		}
	}
}



Measured memory_bytes: 39372
#include<iostream>
#include<vector>
#include<map>
#include<tuple>
#include<string>
#include<cmath>
#include<climits>
#include<algorithm>
#include<bitset>
#include<set>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pii pair<int,int>
#define piii pair<int,pii>
#define mp make_pair
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-5;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
#define DIV 1000000007
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m; x=x*x%m;n>>=1;}return r%m;}
using namespace std;
 
int main(){
  string s; cin >> s;
  cout << s.substr(0,s.size()-8) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll x;
int main()
{
	cin>>x;
	for(ll i=-120;i<=120;i++)
	for(ll j=-120;j<=120;j++)
	{
		if(i*i*i*i*i-j*j*j*j*j==x)
		{
			cout<<i<<" "<<j;
			return 0;
		}
	}
    return 0;
}


Measured memory_bytes: 3620
import numpy as np

N,T = map(int, input().split())
t = np.array(list(map(int, input().split())))

t = np.append(t[1:], t[-1]+T) - t #隣との差分の行列
t = list(sorted(t))

borderIndex = t.index(T)

ans = int(sum(t[0:borderIndex]) + np.int64(len(t[borderIndex:])*T))
print(ans)

Measured memory_bytes: 34196
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
    }
    //要するに2の素因数の総数
    int64_t sum = 0;
    rep(i,n){
        if(a[i]%2==0){
            while(a[i]%2==0){
                a[i] /= 2;
                sum++;
            }
        }
        
    }
    cout << sum <<endl;
}

Measured memory_bytes: 256
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())


#n = ip()                              #入力整数1つ
x,y= (int(i) for i in input().split())      #入力整数横2つ
#k,a,b = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意

for i in range(x):
    if not('0' <=a[i] and a[i] <= '9') :j(0)
if a[x] !='-' : j(0)
for i in range(x+1,y+x+1):
    if not('0' <=a[i] and a[i] <= '9') :j(0)
j(1)

Measured memory_bytes: 13380
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define Yes(condition) if(condition){ cout << "Yes" << '\n'; }else{ cout << "No" << '\n'; }
#define YES(condition) if(condition){ cout << "YES" << '\n'; }else{ cout << "NO" << '\n'; }
#define yes(condition) if(condition){ cout << "yes" << '\n'; }else{ cout << "no" << '\n'; }




int main() {
    ll n;
    cin >> n;
    map<ll, ll> mp;
    vector<ll> a(n);
    REP(i, n){
        cin >> a[i];
        mp[a[i]]++;
    }
    
    sort(a.begin(), a.end());

    ll ans = 0;
    for(ll i = n - 1; i >= 0; i--){
        if(mp[a[i]] == 0) continue;
        mp[a[i]]--;
        ll k = 0;
        for(ll t = a[i]; t > 0; t >>= 1){
            k++;
        }
        
        ll mask = (1LL << k) - 1;
        ll m = (~a[i] + 1) & mask;
        for(ll p = k; p < 32; p++){
            m |= 1LL << p;
        }
        for(ll p = 31; p >= k; p--){
            m ^= 1LL << p;
            // cerr << m << endl;
            if(mp[m] > 0){
                mp[m]--;
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
        cin >> A[i];

    sort(A.begin(), A.end(), greater<int>());
    vector<int> longest;
    for (int i = 0; i < N; i++) {
        if (A[i] == A[i + 1]) {
            longest.push_back(A[i]);
            i++;
        }
        if (longest.size() == 2) {
            cout << (long long)longest[0] * longest[1] << endl;
            return 0;
        }
    }
    
    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static final long MOD = 998244353;
	static int N;
	static int[] blue;

	public static void main(String[] args) {
		char[] S = sc.next().toCharArray();
		N = S.length;
		blue = new int[N];
		for (int i = 0; i < N; i++) {
			blue[i] = S[i] - '0';
		}
		int[] max = greedy();
		for (int i = 0; i < N; i++) {
			blue[i] = 2 - blue[i];
		}
		int[] min = greedy();
		for (int i = 1; i <= 2 * N; i++) {
			min[i] = i - min[i];
		}
//		System.err.println(Arrays.toString(max));
//		System.err.println(Arrays.toString(min));
		long[][] dp = new long[2][2 * N + 1];
		dp[0][0] = 1;
		for (int i = 0, t = 0; i < 2 * N; i++, t ^= 1) {
			Arrays.fill(dp[t ^ 1], 0);
			for (int j = min[i]; j <= max[i]; j++) {
				dp[t ^ 1][j] += dp[t][j];
				if (dp[t ^ 1][j] >= MOD) dp[t ^ 1][j] -= MOD;
				dp[t ^ 1][j + 1] += dp[t][j];
				if (dp[t ^ 1][j + 1] >= MOD) dp[t ^ 1][j + 1] -= MOD;
			}
		}
		System.out.println(dp[0][max[2 * N]]);
	}

	static int[] greedy() {
		int[] count = blue.clone();
		int[] ret = new int[2 * N + 1];
		for (int i = 0; i < 2 * N; i++) {
			if (count[0] > 0) {
				ret[i + 1] = ret[i] + 1;
			} else {
				ret[i + 1] = ret[i];
			}
			if (count[0] > 0) count[0]--;
			for (int j = 1; j < N; j++) {
				if (count[j] > 0) {
					count[j - 1]++;
					count[j]--;
				}
			}
		}
		return ret;
	}
}


Measured memory_bytes: 25536
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int k,a,b; cin >> k >> a >> b;
    if(a + 2> b or k <= a){
        return cout << k + 1 << endl,0;
    }
    int ans = 0;
    k -= a+1;
    ans += b;
    int dif = b - a;
    cout << ans + dif*(k/2) + (k%2) << endl;
}



Measured memory_bytes: 256
N = int(input())
list = []
for i in range(10100):
    list.append(0)

for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            n = x*x + y*y + z*z + x*y + y*z +z*x
            if n <= 10000:
                list[n] += 1
                
for i in range(N):                
    print(list[i+1])

Measured memory_bytes: 9304
#include <bits/stdc++.h>
using namespace std;
 
int main() 
{
  int N,K;
  cin >>N>>K;
  int x=1;
  
  for(int i=0;i<N;i++) 
  {
  if((x*2)<(x+K))
  x*=2;
  else x+=K;
  //cout<<x<<endl;
  }
  cout<<x<<endl;
 }


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

int main(){
    int d;

    string ans = "Christmas";

    cin >> d;

    if(d == 24){
        ans += " Eve";
    }else if(d == 23){
        ans += " Eve Eve";
    }else if(d == 22){
        ans += " Eve Eve Eve";
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
  string s , t ;
  cin >> s >> t ;
  
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  
  if(s<t){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

int main() {

	int n;
	int m1=0,a1=0,c1=0,r1=0,h1=0;
	ll total=0;
	string s;

	cin>>n;

	rep(i,n){
		cin>>s;
		if(s[0]=='M')m1++;
		if(s[0]=='A')a1++;
		if(s[0]=='R')r1++;
		if(s[0]=='C')c1++;
		if(s[0]=='H')h1++;
	}
	ll m2=0,a2=0,r2=0,c2=0,h2=0;

	a2=(r1+c1+h1)*a1;
	r2=(c1+h1)*r1;
	c2=(h1)*c1;
	m2=(a2+c2+r2)*m1;
	total+=m2;

	r2=(c1+h1)*r1;
	c2=(h1)*c1;
	a2=(c2+r2)*a1;
	total+=a2;

	c2=(h1)*c1;
	r2=(c2)*r1;
	total+=r2;

	cout<<total<<endl;
	return 0;
}


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

namespace atc
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();

            if (S.Length == 2)
            {
                Console.WriteLine(S);
            }
            else if (S.Length == 3)
            {
                for (int i = 0; i < S.Length; i++)
                {
                    int reverse = S.Length - i - 1;
                    Console.Write(S[reverse]);
                }
                Console.WriteLine("");
            }

        }

    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
    long long l, n, ans = 0;
    cin >> l >> n;
    vector<long long> x(n + 1), s(n + 1), rs(n + 2);
    for(int i = 1; i < n + 1; i++){
        cin >> x[i];
        s[i] = x[i];
        rs[i] = l - x[i];
    }
    if(n == 1){
        cout << max(x[1], l - x[1]) << endl;
        return 0;
    }
    for(int i = 1; i < n + 1; i++){
        s[i] += s[i - 1];
    }
    for(int i = n - 1; i > 0; i--){
        rs[i] += rs[i + 1];
    }
    for(int i = 1; i < n; i++){
        long long d = 0, c = n - i, le = c / 2, ri = n - (c + 1) / 2 + 1;
        d = 2 * (x[i] + s[i + le] - s[i] + rs[ri]);
        if(c % 2 == 0)
            d -= x[i + le];
        else
            d -= l - x[ri];
        ans = max(ans, d);
    }
    for(int i = n; i > 1; i--){
        long long d = 0, c = i - 1, le = (c + 1) / 2, ri = i - c / 2;
        d = 2 * (l - x[i] + s[le] + rs[ri] - rs[i]);
        if(c % 2 == 0)
            d -= l - x[ri];
        else
            d -= x[le];
        ans = max(ans, d);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int W = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();
		
		int ans;
		if(Math.abs(a - b) <= W) {
			ans = 0;
		} else if(a < b) {
			ans = b - (a + W);
		} else {
			ans = a - (b + W);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21716
def solve():
    N, D = map(int, input().split())
    ans = 0
    for _ in range(N):
        x, y = map(int, input().split())
        if (x ** 2 + y ** 2) ** 0.5 <= D:
            ans += 1
    print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 9632
package main
import(
  "fmt"
)
func main(){
  var a, b, c, d, i int
  fmt.Scan(&a, &b, &c, &d)
  for i=0;;i++{
    if i%2==0{
      c-=b
      if c<=0{
        fmt.Println("Yes")
        return
      }
    }else{
      a-=d
      if a<=0{
        fmt.Println("No")
        return
      }
    }
  }
}


Measured memory_bytes: 1748
#include<bits/stdc++.h>                                                                
#define rep(i,n) for (int i = 0; i < n; ++i)                                           
#define rep2(i,s,n) for (int i = s; i < n; ++i)                                        
#define all(a) a.begin(),a.end()                                                       
using namespace std;                                                                   
                                                                                       
int main() {                                                                           
    string s;                                                                          
    cin >> s;                                                                          
    string s1 = s.substr(0,5),s2 = s.substr(6,7),s3 = s.substr(14);                    
    cout << s1 << " " << s2 << " " << s3 << endl;                                      
}                                                                                      

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=55;
const int MOD=1e9+7;



int main()
{
    string s;
    cin>>s;
    int ans = 0;

    for(int i = 1; i < s.size(); i++)
    {
        if(s[i] != s[i-1])
            ans++;
    }
    cout<<ans;


    return 0;
}





Measured memory_bytes: 512
import sys

input=sys.stdin.read().split()
a=1
b=2
c=3
d=5
e=4
f=6
x=1





for command in input[1:]:


  if command=='North':
    a,b,d,f,c,e=b,f,a,d,c,e
    x=x+a
  elif command=='South':
    a,d,f,b,c,e=d,f,b,a,c,e
    x=x+a
  elif command=='West':
    a,e,c,f,d,b=c,a,f,e,d,b
    x=x+a
  elif command=='East':
    a,e,c,f,b,d=e,f,a,c,b,d
    x=x+a
  elif command=='Right':
    c,d,e,b,a,f=d,e,b,c,a,f
    x=x+a
  elif command=='Left':
    c,b,e,d,a,f=b,e,d,c,a,f
    x=x+a
  else:
      print x
      a=1
      b=2
      c=3
      d=5
      e=4
      f=6
      x=1
  
  
 

 
 

Measured memory_bytes: 4572
#include <bits/stdc++.h>
using namespace std;
int main()
{
	// freopen("AGC010-D.in", "r", stdin);
	int n, cur = 0;
	cin >> n;
	vector<int> arr(n);
	copy(istream_iterator<int>(cin), istream_iterator<int>(), arr.begin());
	string str[] = {"First", "Second"}, ans;
	while (ans.empty()) {
		int cnt = count_if(arr.begin(), arr.end(), [&] (int x) { return x % 2 == 0; });
		if (cnt & 1) {
			ans = str[cur];
			break;
		}
		cur ^= 1;
		if (cnt != n - 1) {
			ans = str[cur];
		}
		int g = 0;
		for_each(arr.begin(), arr.end(), [&] (int x) {
			if (x == 1) {
				ans = str[cur];
			}
			x -= x & 1;
			while (x) {
				int r = g % x;
				g = x;
				x = r;
			}
		});
		if (!g) {
			break;
		}
		for_each(arr.begin(), arr.end(), [&] (int &x) { x /= g; });
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
  int A,B;
  cin >> A >> B;
  if(B==1)
    cout << 0 << endl;
  else{
  int c=A,d=1;
  while(c<B){
    c=c+A-1;
    d++;
  }
  
  cout << d << endl;
  }
  
}

Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    S = input()
    N = len(S)
    p = 10**9 + 7
    dp = [[0]*13 for _ in range(N+1)]
    dp[0][0] = 1

    for i in range(N):
        if S[i] == '?':
            for j in range(13):
                for k in range(10):
                    dp[i+1][(10*j+k)%13] += dp[i][j]
                    dp[i+1][(10*j+k)%13] %= p
        else:
            s = int(S[i])
            for j in range(13):
                dp[i+1][(10*j+s)%13] = dp[i][j]
    print(dp[N][5])
    

if __name__ == "__main__":
    main()


Measured memory_bytes: 96624
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<string>
#include<set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0; i<n; i++)
#define per(i, n) for(int i=n-1; i>=0; i--)
#define reps(i, n) for(int i=1; i<n; i++)
#define pers(i, n)  for(int i=n-1; i>=1; i--)

const int INF = 1001001001;

void solve(){
  int n;  cin >> n;
  while(n){
    if(n%10==7){
      cout << "Yes" << endl;
      return;
    }
    n/=10;
  }
  cout << "No" << endl;
}

int main(){
  solve();
  return 0;
}


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

int main(){
    int n;
    cin >> n;
    int a[n];
    map<int, int> m;
    ll ans = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        ans += a[i];
        auto itr = m.find(a[i]);
        if(itr == m.end()){
            m[a[i]] = 1;
        }else{
            m[a[i]]++;
        }
    }

    int q;
    cin >> q;
    int b[q], c[q];
    for(int i= 0; i < q; i++){
        cin >> b[i] >> c[i];
    }

    for(int i = 0; i < q; i++){
        auto itr = m.find(b[i]);
        if(itr != m.end()){
            int cou = itr->second;
            if(cou != 0){
                auto itr_2 = m.find(c[i]);
                if(itr_2 == m.end()){
                    m[c[i]] = cou;
                }else{
                    m[c[i]] += cou;
                }

                ans += (c[i] - b[i]) * cou;

                m[b[i]] = 0;
            }
        }

        cout << ans << endl;
    }
}

Measured memory_bytes: 8264
#include <iostream>
#include <string>
#include <set> 
#include <vector>
#include <algorithm>
#include <bitset>
#define ll long long
using namespace std;

int main(){
    string s;
    cin>>s; int ans=0;
    for(int i=0;i<4;i++){
        if(s[i]=='+') ans++;
        else ans--;

    }
cout<<ans<<endl;;

    return 0;

}

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

int main() {
	cout << fixed << setprecision(10);
	int N;
	double t, u;;
	cin >> N;
	priority_queue<double,vector<double>,greater<double>> v;
	for (size_t i = 0; i < N; i++)
	{
		cin >> t;
		v.push(t);
	}
	while(v.size() >= 2) {
		t = v.top();
		v.pop();
		u = v.top();
		v.pop();
		v.push((t + u) / 2);
	}
	cout << v.top();
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>

typedef long long ll;
const ll INF = 1e18;

ll a[51];
ll p[51];

ll f(ll n, ll x)
{
  if (n == 0) {
    return x <= 0 ? 0 : 1;
  }
  if (x <= 1+a[n-1]) {
    return f(n-1,x-1);
  } else {
    return p[n-1]+1+f(n-1,x-2-a[n-1]);
  }
}

int main(int argc, char* argv[])
{
  ll N, X;
  std::cin >> N >> X;

  a[0] = 1;
  p[0] = 1;
  for (ll i = 1; i <=50; i++) {
    a[i] = 2 * a[i-1] + 3;
    p[i] = 2 * p[i-1] + 1;
  }

  std::cout << f(N, X) << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;

int main(){
  
  int r; cin>>r;
  if(r<1200) cout<<"ABC"<<endl;
  else if(r<2800)cout<<"ARC"<<endl;
  else cout<<"AGC"<<endl;
  
  
}


Measured memory_bytes: 3624
// E - Golf
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char *argv[])
{
	long long k, x, y, sx = 1, sy = 1;
	cin >> k >> x >> y;

	if (k % 2 == 0 && (abs(x) + abs(y)) % 2 == 1) {
		cout << -1 << endl;
		return 0;
	}

	if (x < 0) x = -x, sx = -1;
	if (y < 0) y = -y, sy = -1;

	long long n = (x + y + k - 1) / k, cx = 0, cy = 0;
	if (n == 1 && (x + y != k)) n++;
	while ((n * k - x - y) % 2) n++;

	cout << n << endl;

	for (long long w = (n * k - x - y) / 2; w > 0; ) {
		bool t = abs(x - cx) < abs(y - cy);
		if (t) cx -= min(k, w);
		else cy -= min(k, w);
		long long r = k - min(k, w);
		if (t) cy += r;
		else cx += r;
		w -= min(k, w);
		cout << cx * sx << ' ' << cy * sy << endl;
	}

	while (cx != x || cy != y) {
		long long r = k;
		if (cx != x) {
			long long d = min(k, x - cx);
			cx += d;
			r -= d;
		}
		if (cy != y) {
			long long d = min(r, y - cy);
			cy += d;
			r -= d;
		}
		cout << cx * sx << ' ' << cy * sy << endl;
	}

	return 0;
}


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

int main()
{
  stack<char> S;
  string s;
  char c,C[90];
  int a,b;
  while(1){
    cin>>s;
    if(s[0]=='.')break;
    for(int i=0;i<s.length();i++){
      if(s[i]>='A' && s[i]<='Z'){
	while(!S.empty() && (S.top()=='+' || S.top()=='-')){
	  if(S.top()=='+'){
	    if(s[i]=='Z')s[i]='A';
            else s[i]++;
	  }
          else if(S.top()=='-'){
            if(s[i]=='A')s[i]='Z';
	    else s[i]--;
	  }
          S.pop();
	}
	S.push(s[i]);
      }
      else if(s[i]=='?'){
        while(!S.empty() && (S.top()=='+' || S.top()=='-')){
	  S.pop();
	}
        S.push('?');
      }
      else if(s[i]==']'){
	b=0;
        while(S.top()!='['){
	  C[b++]=S.top();S.pop();
	}
	S.pop();
        for(int i=0;i<b;i++)S.push(C[i]);
      }
      else{
	S.push(s[i]);
      }
    }
    a=S.size();b=0;
    while(!S.empty()){
      C[b++]=S.top(),S.pop();
    }
    for(int i=b-1;i>=0;i--){
      if(C[i]=='?')cout<<'A';
      else cout<<C[i];
    }
    cout<<endl;
  }
  return 0;
}

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


int main(){
    int A,B;
    cin >> A >> B;
    cout << ((A <=8) && (B <= 8) ? "Yay!" : ":(") << endl;
}

Measured memory_bytes: 256
l = list(map(int, input().split()))
ans = 0
while l[0] != l[1] or l[0] != l[2]:
    ans += 1
    l.sort()
    if l[2] > l[1]:
        l[0] += 1
        l[1] += 1
    else:
        l[0] += 2
print(ans)


Measured memory_bytes: 61868
ENV[Z='RUBY_THREAD_VM_STACK_SIZE']||(require'rubygems';exec({Z=>'50000000'},Gem.ruby,$0));def f(i)a=H[i].map{|e|-f(e)}.sort;r=0;a.size.times{|i|x=i+1-a[i];r<x&&r=x};r end;N=gets.to_i;H=Hash.new{|h,k|h[k]=[]};2.upto(N){|i|H[gets.to_i]<<i};p f 1

Measured memory_bytes: 225276
var
  n:integer;
  a:integer;
  i: integer;
  min:integer;
  max:integer;
begin
  readln(n);
  min := 1000000001;
  max := 0;
  for i := 1 to n do begin
    read(a);
    if a < min then min := a;
    if a > max then max := a;
  end;
  writeln(max - min);
end.

Measured memory_bytes: 128
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

constexpr int64_t DIV1097 = 1000000007LL;

using namespace std;

int main()
{
    int64_t N, T;
    std::cin >> N >> T;

    auto cmp = [](const auto &l, const auto &r) {return l > r;};
    std::map<int64_t, int64_t, decltype(cmp)> D(cmp);
    int64_t prev = 0;
    for (decltype(N) i = 0; i < N; ++i) {
        int64_t t;
        std::cin >> t;

        if (i == 0) {
            prev = t;
        }

        if (t > prev) {
            D[t - prev]++;
        }
        else {
            prev = t;
        }
    }

    cout << D.begin()->second << endl;

    return 0;
}


Measured memory_bytes: 6528
from collections import deque

def solve(count, i, g, pcs, rem):
    if g <= 0:
        return count
    if pcs == []:
        index, p = rem
        if index == 0:
            return count
        plus = g // (100 * index) + (1 if g % (100 * index) != 0 else 0)
        return count + plus if plus < p else float("Inf")
    p, c = pcs[0]
    l = pcs[1:]
    a = solve(count, i + 1, g, l, (i, p))
    b = solve(count + p, i + 1, g - c - 100 * i * p, l, rem)
    return a if a < b else b



if __name__ == "__main__":
    d, g = map(int, input().split())
    pcs = [tuple(int(s) for s in input().split()) for _ in range(d)]
    print(solve(0, 1, g, pcs, (0, 0)))


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

// vp prime_factorize(int n){
//     vp ret;
//     for(int p=2; p*p<=n; p++){
//         if(n%p!=0) continue;
//         int num=0;
//         while(n%p==0){
//             num++;
//             n/=p;
//         }
//         ret.PB(MP(p,num));
//     }
//     if(n!=1) ret.PB(MP(n,1));
//     return ret;
// }

map<int,int> prime_factorize(int n){
    map<int,int> map;
    for(int p=2; p*p<=n; p++){
        if(n%p!=0) continue;
        int num=0;
        while(n%p==0){
            num++;
            n/=p;
        }
        //ret.PB(MP(p,num));
        map[p]=num;
    }
    //if(n!=1) ret.PB(MP(n,1));
    if(n!=1) map[n]=1;
    return map;
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int a,b; cin >> a >> b;
    map<int,int> fa=prime_factorize(a),fb=prime_factorize(b);

    int res=1;
    FOR(i,1,sqrt(a)){
        if(fa[i]>0&&fb[i]>0){
            res++;
            //cout<<i<<' ';
        }
        if(fa[a/i]>0&&fb[a/i]>0) {
            res++;
            //cout<<a/i<<' ';
        }
    }
    cout<<res<<endl;

}

Measured memory_bytes: 128604
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(long long i=0;i<n;i++)
#define REPP(i,m,n) for(long long i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "debug" << endl;
#define pb push_back
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; }

int main() {
    cin.tie(0);    
	ios::sync_with_stdio(false);
    int N;
    cin >> N;
    string S[N];
    ll M = 0,A = 0,R = 0,C = 0,H = 0;

    ll sum = 0;
    REP(i,N){
        cin >> S[i];
        if(S[i][0] == 'M') M++;
        else if(S[i][0] == 'A') A++;
        else if(S[i][0] == 'R') R++;
        else if(S[i][0] == 'C') C++;
        else if(S[i][0] == 'H') H++;
    }
    sum += M*A*R;
    sum += M*A*C;
    sum += M*A*H;
    sum += M*R*C;
    sum += M*R*H;
    sum += M*C*H;
    sum += A*R*C;
    sum += A*R*H;
    sum += A*C*H;
    sum += R*C*H;
    cout << sum << endl;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
#define Re read()
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define fd(i,a,b) for(register int i=a;i>=b;--i)
using namespace std;
typedef long long ll;

inline int read(int n=0) {
    register char ch;while(!isdigit(ch=getchar()));
    for(n=ch^48;isdigit(ch=getchar());n=(n<<3)+(n<<1)+(ch^48));return n;
}
double a,b,x,h,s;
int main() {
	cin>>a>>b>>x;
	s=a*a*b;
	if(s==(x*2)){
		printf("45.0000000000");
	}
	else if((x*2)<s){
		h=2.0*x/a/b;
		printf("%.10lf",90.0-atan(1.0*h/b)*180.0/3.14159265359);
	} else {
		x=s-x;h=2.0*x/a/a;
		printf("%.10lf",atan(1.0*h/a)*180.0/3.14159265359);
	}
    return 0;
}

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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

struct Key {
    int price, code;
    Key(int price = INT_MAX, int code = 0) : price(price), code(code) {}
    Key operator+(const Key& key) { return Key(price + key.price, code | key.code); }
};

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

    int n, m;
    cin >> n >> m;

    vector<Key> keys(m);
    rep(i, 0, m) {
        int b;
        cin >> keys[i].price >> b;
        rep(j, 0, b) {
            int c;
            cin >> c;
            keys[i].code |= (1 << (c - 1));
        }
    }

    // O(m * n)
    vector<Key> min_keys(n);
    rep(i, 0, n) {
        rep(j, 0, m) {
            if ((keys[j].code & (1 << i)) && min_keys[i].price > keys[j].price) {
                min_keys[i] = keys[j];
            }
        }
    }

    // 開けない宝箱がある場合．
    rep(i, 0, n) {
        if (min_keys[i].price == INT_MAX) {
            cout << -1 << endl;
            return 0;
        }
    }

    // O(2^n * m)
    vector<Key> dp(1 << n);
    dp[0].price = 0;

    rep(bit, 1, 1 << n) {

        // すべての鍵に関してループ．
        rep(i, 0, m) {

            // 1回前の状態．
            int prev_bit = bit & (~keys[i].code);

            // この鍵が関係ないときはスキップする．
            if (bit == prev_bit) { continue; }

            if (dp[bit].price == INT_MAX || dp[bit].price > dp[prev_bit].price + keys[i].price) {
                dp[bit] = dp[prev_bit] + keys[i];
            }
        }
    }

    cout << dp.back().price << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
import math

def main():
    n, m = input_list()
    if abs(n-m) > 1:
        print(0)
        exit()
    mod = 10**9 + 7
    diff = abs(n-m)
    if diff == 1:
        ans = math.factorial(n) * math.factorial(m)
        print(ans % mod)
    else:
        ans = 2 * (math.factorial(n) * math.factorial(m))
        print(ans % mod)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)


def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()


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

using namespace std;

struct node{
	deque<int> cld;
	bool vi;
	int sz;
	node(){
		vi = 0;
		sz = 0;
	}
}a[2001];

int ans[2001];

int main(){
	int n , x , y;
	cin>>n>>x>>y;
	for(int i = 1 ; i < n ; i++){
		a[i].cld.push_back(i+1);
		a[i+1].cld.push_back(i);
	}
	a[x].cld.push_back(y);
	a[y].cld.push_back(x);
	for(int s=1;s<=n;s++) {
		for(int i=1;i<=n;i++)
			a[i].vi = 0;
		deque<int> q;
		q.push_back(s);
		a[s].vi = 1;
		a[s].sz = 0;
		while(!q.empty()){
			for(int i:a[q.front()].cld) {
				if(!a[i].vi) {
					a[i].vi = 1;
					a[i].sz = a[q.front()].sz + 1;
					q.push_back(i);
				}
			}
			q.pop_front();
		}
		for(int i=1;i<=n;i++) ans[a[i].sz]++;
	}
	for(int i=1;i<n;i++) cout << ans[i] / 2 << endl;
}

Measured memory_bytes: 1664
// In the name of God 
#include <bits/stdc++.h>

using namespace std ;
 
//#define int long long
#define all(v) v.begin() , v.end()

template<typename T> inline bool smin(T &a, const T &b){ return b < a ? a = b,1:0;}
template<typename T> inline bool smax(T &a, const T &b){ return a < b ? a = b,1:0;}

const int N = 3000 + 10 ; 

int n , a [ N ] , per [ N ] ; 
bool dp [ N ] ;
vector < int > adj [ N ] , op ; 

int32_t main()                     
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n ;
	for ( int j = 0 ; j < n ; ++j )
		cin >> a [ j ] ;
	for ( int j = 0 ; j < n - 1 ; ++j ) {
		int u , v;
		cin >> u >> v;
		--u , --v ;
		adj [ u ].push_back ( v ) ;
		adj [ v ].push_back ( u ) ; 
	}
	iota ( per , per + N , 0 ) ;
	sort ( per , per + n , [&] ( int x , int y ) { return a [ x ] < a [ y ] ; } ) ;
	for ( int j = 0 ; j < n ; ++j ) {
		int v = per [ j ] ;
		if ( dp [ v ] ) continue ;
		for ( int u : adj [ v ] ) {
			if ( a [ u ] > a [ v ])
				dp [ u ] = true ; 
		}
	}
	for ( int j = 0 ; j < n ; ++j )
		if ( dp [ j ] )
			cout << j + 1 << ' ' ;
	cout << '\n' ; 
}


Measured memory_bytes: 512
#include <iostream>

int main()
{
	for(int i = 1; i <= 9; i++)
	{
		for(int j = 1; j <= 9; j++)
		{
			std::cout << i << "x" << j << "=" << i*j << std::endl;
		}
	}
	

	return 0;
}

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

typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define REPR(i,a,b) for(ll i=b;i>=a;i--)
#define repr(i,n) REPR(i,0,n)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second
#define m_p make_pair

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

    ll h,w;
    cin >> h >> w;
    char a[101][101];
    rep(i,h)
        rep(j,w)
            cin >> a[i][j];
    rep(i,h+2){
        rep(j,w+2){
            if(i==0 || j==0 || i==h+1 || j==w+1){
                cout << '#';
            }else{
                cout << a[i-1][j-1];
            }
        }
        cout << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
using namespace std;

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};

//ll mod = 1000000009;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    int n; cin >> n;
    vector<pair<ll,ll>> a(n),b(n);
    rep(i,n) cin >> a[i].first >> a[i].second;

    rep(i,n){
        b[i].first = a[i].first + a[i].second;
        b[i].second = a[i].first - a[i].second;
    }
    sort(b.begin(),b.end());
    int i = 0, j = 1, cnt = 0;
    while(j < n){
        if(b[i].first <= b[j].second){
            i = j;
            j++;
        }else{
            j++;
            cnt++;
        }
    }
    cout << n - cnt << endl;
}




Measured memory_bytes: 6404
#include <iostream>
#include <algorithm>
#include <vector>
#include <tuple>
#include <cstring>


#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define eREP(i, n) for(int (i) = 0; (i) <= (n); ++(i))
#define rREP(i, n) for(int (i) = (n) - 1; (i) >= 0; ++(i))
#define ALL(TheArray) TheArray.begin(), TheArray.end()

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

using lli = long long int;

std::string s;

int solve(){
    const int n = s.size();
    int l = 0; char c1 = '?', c2 = '\0';
    int idx = 0; int res = 0;
    while(idx < n){
        if(l == 1){
            if(c1 == s[idx]){
                if(idx + 1 < n){
                    c2 = s[++idx];
                    l = 2;
                }
                else break;
            }
            else c1 = s[idx];
        }
        else{
            c1 = s[idx];
            l = 1;
        }
        idx++; res++;
    }
    return res;
}

int main(void){
    std::cin >> s;
    std::cout << solve() << '\n';
    return 0;
}


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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

string s;
int cur=0;

char Letter();
string String();
string Cipher();

char Letter(){
	int val=0;
	while(!isupper(s[cur])){
		if(s[cur]=='?'){
			cur++;
			return 'A';
		}
		if(s[cur]=='+')
			val++;
		if(s[cur]=='-')
			val--;
		cur++;
		val=(val+26)%26;
	}
	int idx=s[cur++]-'A';
	return (idx+val+26)%26+'A';
}

string String(){
	int n=s.size();
	string res="";
	while(cur<n){
		if(s[cur]=='['){
			cur++;
			res=Cipher();
			cur++;
			reverse(res.begin(),res.end());
			return res;
		}else{
			res+=Letter();
			return res;
		}
	}
	return res;
}

string Cipher(){
	int n=s.size();
	string res="";
	while(cur<n){
		if(s[cur]==']')
			break;
		res+=String();
	}
	return res;
}

int main(void){
	while(cin >> s){
		if(s==".")
			break;
		cur=0;
		cout << Cipher() << endl;
	}
	return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
int main() 
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int N,K;
    cin>>K>>N;
    int arr[N];
    for(int i=0;i<N;i++)
        cin>>arr[i];
    int sum=0;
    for(int i=1;i<N;i++)
    {
        sum+=arr[i]-arr[i-1];
    }
    int diff=INT_MIN;
    for(int i=1;i<N;i++)
    {
        if(diff<arr[i]-arr[i-1])
        {
            diff=arr[i]-arr[i-1];
        }
    }
    int sum2=sum-diff+arr[0]+K-arr[N-1];
    if(sum<sum2)
        cout<<sum;
    else
        cout<<sum2;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printInt(a) printf("%d\n", a)
#define scanInt(a) scanf("%d", &a)
#define scan2Int(a, b) scanf("%d %d", &a, &b)
#define scan3Int(a, b, c) scanf("%d %d %d", &a, &b, &c)
using namespace std;

int main() {
    char s[4];
    scanf("%s", s);
    if (s[0] == s[1] && s[0] == s[2])
        printf("No\n");
    else
        printf("Yes\n");
}


Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void run() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
}
const int N = 2e5+5;



int main() {
/*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif*/
    run();
    unordered_map<string,int> mp;
    int n;
    cin>>n;
    for (int i = 0; i <n ; ++i) {
        string s;
        cin>>s;
        mp[s]++;
    }
    cout<<"AC x "<<mp["AC"]<<'\n'
        <<"WA x "<<mp["WA"]<<'\n'
        <<"TLE x "<<mp["TLE"]<<'\n'
        <<"RE x "<<mp["RE"];

    return 0;
}

Measured memory_bytes: 3668