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

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

    if(a[0] <= a[2] || a[1] <= a[3]){
        cout << "No" << endl;
    }
    else if((a[2]-a[4]) < 0 || (a[2]+a[4]) > a[0]){
        cout << "No" << endl;
    }else if((a[3]-a[4]) < 0 || (a[3]+a[4]) > a[1]){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}


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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int x, a, b;
    cin >> x >> a >> b;
    if(abs(x - a) < abs(x - b))cout << "A" << endl;
    else
        cout << "B" << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool vis[120];
int main() {
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    int mod=c%(a+b);
    if(mod<=a) printf("%d\n",c);
    else {
        int ans=c;
        while(mod%(a+b)>a) {
            vis[mod]=1;
            mod=(mod+60)%(a+b);
            ans+=60;
            if(vis[mod]) break;
        }
        if(mod<=a) printf("%d\n",ans); else printf("-1\n");
    }
}

Measured memory_bytes: 3216
class Node:
    def __init__(self, prev, val, next):
        self.prev = prev
        self.val = val
        self.next = next


NIL = 0
START = -1
END = -2


class List:
    def __init__(self, li):
        li.append(END)
        self.li = [Node(NIL, START, NIL)]
        for e in li:
            node = Node(self.li[-1], e, NIL)
            self.li[-1].next = node
            self.li.append(node)

        self.l = len(self.li) - 1
        self.ans = []

    def step(self):
        i = self.l
        u = self.li[-1]
        while u.val != START:
            if u.val == i:
                u.prev.next = u.next
                u.next.prev = u.prev
                self.ans.append(u.val)
                self.l -= 1
                return True

            else:
                u = u.prev
                i -= 1

        self.ans = [-1]
        return False

    def solve(self):
        for _ in range(self.l - 1):
            if not self.step():
                break

        print(*self.ans[::-1], sep="\n")


def main():
    n = int(input())
    b = list(map(int, input().split()))

    l = List(b)
    l.solve()


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.BitSet;
import java.util.HashSet;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(bf.readLine());
        StringBuilder sb = new StringBuilder();
        BitSet bitSet = new BitSet(13554432);
        final char[] key = new char[128];
        key['A'] = 0;
        key['C'] = 1;
        key['G'] = 2;
        key['T'] = 3;
        for (int i = 0; i < n; i++) {
            String sp = bf.readLine();
            if (sp.charAt(0) == 'i') {
                int hash = 1;
                for (int j = 7; j < sp.length(); j++) {
                    hash <<= 2;
                    hash+=key[sp.charAt(j)];
                }
                bitSet.set(hash);
            } else {
                int hash = 1;
                for (int j = 5; j < sp.length(); j++) {
                    hash <<= 2;
                    hash+=key[sp.charAt(j)];
                }
                sb.append(bitSet.get(hash) ? "yes\n" : "no\n");
            }
        }
        bf.close();
        System.out.print(sb.toString());
    }
}


Measured memory_bytes: 68344
/*  
    Come feed the rain
	Cos I'm thirsty for your love
	Dancing underneath the skies of lust
	Yeah feed the rain...
	Cos without your love my life
	Ain't nothing but this carnival of rust
    _________________________
    _________________________
    816 Hours of Solitude
    Quarantine_Day : 34
*/

#include<bits/stdc++.h>

using namespace std;

typedef long long int       ll;
typedef vector<int>         vi;
typedef vector<ll>          vl;
typedef pair<int, int>      pii;

#define pb(n)           push_back(n)
#define GSORT(v)        sort(v.begin(), v.end(), greater<int>())
#define SORT(v)         sort(v.begin(), v.end());
#define REV(v)          reverse(v.begin(), v.end());
#define db(a)           cout<<#a<<" = "<<a<<endl;
#define FIN             freopen("in.txt","r",stdin);
#define FOUT            freopen("out.txt","w",stdout);
#define REP(i,n)        for(int i = (int)(0); i < (int)(n); i++)
#define FOR(i, a, b)    for(int i = (int)a; i <= (int)b; i++)    

#define MAX 50005

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

	int r, c;
	cin>>r>>c;

	string s[r];
	REP(i, r) cin>>s[i];
	REP(i, r) cout<<s[i]<<"\n"<<s[i]<<"\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    long long int t[100],t1[100];int m,n;long long int x[100],p[100];long long int s[100];
    cin>>n;long long int i;
    long long int j,k;
    for(i=1;i<=n;i++)
    cin>>t[i];
    for(i=1;i<=n;i++)
    t1[i]=t[i];
    cin>>m;
    for(i=1;i<=m;i++)
     { cin>>p[i]>>x[i];
       s[i]=0;
      t1[p[i]]=x[i];
      for(j=1;j<=n;j++)
        s[i]=s[i]+t1[j];
      for(k=1;k<=n;k++)
       t1[k]=t[k];
     } 
     
    for(i=1;i<=m;i++)
    cout<<s[i]<<endl;
    
    return 0;
}


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




       
int main(){
long long  n ;
cin >> n;
  long long s[n];
   for(long long i=0; i<n ;i++){
      long long m ;
      cin >> m ;
      s[i]=m;
   }
long long ans =0;
for(auto m :s){

   for(auto p:s){

      for(auto q :s){
      
         if(p>m && q > m && q>p){
           if((m + p > q) && (m+q >p)){
              
               ans++;}
         }
      }
   }
}
cout << ans << endl;
return 0;
  
}
    

Measured memory_bytes: 3632
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n, k;
    cin >> n >> k;
    int ans = ceil((n - 1) * 1.0 / (k - 1));
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <ctime>
#include <iomanip>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdio>
#include <list>
#include <queue>
using namespace std;

#define int long long
#define INF 1e18
#define EPS 1e-9

signed main() {
    int n; cin >> n;
    vector<int> v(n), c(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    for(int i = 0; i < n; i++) cin >> c[i];

    int ans = 0;
    for(int i = 0; i < n; i++) {
        if(v[i] - c[i] > 0) ans += v[i] - c[i];
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    #define ll long long
    using namespace std;
     
    int main()
    {
       int a,b;
       cin>>a>>b;
     
       if(2*b<a)
       {
           cout<<a-(2*b)<<endl;
       }
       else if(2*b>=a)
       {
           cout<<"0"<<endl;
       }
    }

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

int main(){
  int n,ans=0; cin>>n;
  long long sumD=0,lack=0;
  long long a[n],b[n],diff[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    cin>>b[i];
    diff[i]=b[i]-a[i];
    sumD+=diff[i];
  }
  sort(diff,diff+n);
  if(sumD<=0){
    for(int i=0;i<n;i++){
      if(diff[i]>0){
        ans++;
        lack+=diff[i];
      }
    }
    for(int i=0;i<n;i++){
      if(lack<=0){
        break;
      }
      ans++;
      lack+=diff[i];
    }
  }
  if(sumD>0){
    cout<<-1;
  }else{
    cout<<ans;
  }
}

Measured memory_bytes: 2560
# coding: utf-8
# Your code here!
a,b = map(int,input().split(" "))
p = str(a)
q = str(b)
for i in range(b-1):
    p += str(a)
    
for i in range(a-1):
    q += str(b)
    
res = [p,q]
res = sorted(res)
print(res[0])
   

Measured memory_bytes: 3060
#include<algorithm>
#include<string.h>
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
	int a,b;
	cin>>a>>b;
	b*=2;
	if(a<=b){
		puts("0");
	}else{
		cout<<a-b<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int abs(int n)
{
	if (n < 0)
		n *= -1;
	return n;
}
int main()
{
	int n, z, w;
	scanf("%d %d %d", &n, &z, &w);
	int i, j, k;
	int a[2003];
	for (i = 0; i < n; i++)
		scanf("%d", &a[n - i - 1]);
	a[n] = w;
	int dp[2][2003];
	dp[0][0] = dp[1][0] = abs(a[0] - a[1]);
	for (i = 1; i < n; i++)
	{
		k = abs(a[i + 1] - a[0]);
		for (j = 0; j < i; j++)
			if (k < dp[1][j])
				k = dp[1][j];
		dp[0][i] = k;
		k = abs(a[i + 1] - a[0]);
		for (j = 0; j < i; j++)
			if (k > dp[0][j])
				k = dp[0][j];
		dp[1][i] = k;
	}
	printf("%d\n", dp[0][n - 1]);
	return 0;
}

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

int main() {
int N;
cin>> N;
vector<int> al(N) ;
int a=0,b=0;


   
//代入
for (size_t i = 0; i < N; i++)
{
	cin >> al[i];
}

sort(al.begin(), al.end());
reverse(al.begin(), al.end());

for (size_t i = 0; i < N; i++)
{
	if(i%2==0) // i=even
	{a+=al[i];}
	else // i= odd
	{
	b+=al[i];
	}
}

cout << a-b << endl;
	


}




Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
ll const INF = 1LL << 60;
ll const MAX_N = 510000;
ll const MOD = 1000000007;

int main() {
    string S;
    ll K;
    cin >> S >> K;

    vector<int> cnt;
    int small_cnt = 1;
    for (int i = 1; i < S.length(); i++) {
        if (S[i - 1] == S[i]) {
            small_cnt++;
        } else {
            cnt.push_back(small_cnt);
            small_cnt = 1;
        }
    }
    cnt.push_back(small_cnt);

    // repv(cnt) cout << *it << " ";
    // cout << endl;

    if (cnt.size() == 1) {
        cout << S.length() * K / 2 << endl;
        return 0;
    }

    ll ans = 0;
    repv(cnt) { ans += (*it / 2) * K; }

    // cout << ans << endl;

    if (S[0] == S[S.length() - 1]) {
        ans -= (cnt[0] / 2) * (K - 1);
        // cout << "b :" << ans << endl;
        ans -= (cnt[cnt.size() - 1] / 2) * (K - 1);
        // cout << "e :" << ans << endl;
        ans += (cnt[0] + cnt[cnt.size() - 1]) / 2 * (K - 1);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3624
A=input()
n=len(A)
ans=1
for i in range(n):
  if(A[i]=="a"):
    ans=ans*2
  if(A[i]=="b"):
    ans=ans*3
  if(A[i]=="c"):
    ans=ans*4
if(ans==24):
  print("Yes")
else:
  print("No")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int T1, T2, N, A, B;
  cin >> N >> A >> B;
  T1=A*N;
  T2=B;
    
  if(T1<T2){
    cout << T1 << endl;
  }else{
    cout << T2 << endl;
  }
  
}

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

struct Edge {
    int to, weight;
};
using Graph = vector<vector<Edge>>;

int main()
{
    int n; cin >> n;
    Graph g(n);
    for (int i = 0; i < n - 1; i++) {
        int u, v, w; cin >> u >> v >> w;
        u--, v--;
        g[u].push_back({v, w%2});
        g[v].push_back({u, w%2});
    }

    vector<int> ans(n, -1);

    // bfs
    ans[0] = 0;
    queue<int> q;
    q.push(0);
    while (!q.empty()) {
        int v = q.front(); q.pop();
        for (auto& e: g[v]) {
            if (ans[e.to] != -1) continue;
            ans[e.to] = (ans[v] ^ e.weight);
            q.push(e.to);
        }
    }
    
    for (int i = 0; i < n; i++) {
        cout << ans[i] << '\n';
    }
    return 0;
}

Measured memory_bytes: 6784
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <cassert>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const ll MOD = 1e9+7;
const double EPS = 1e-9;


int main(int argc, const char * argv[]) {
  string S; cin >> S;
  string ans = "Yes";
  for(int i=0; i<S.size(); i++){
    if(i%2 == 0){
      if(S[i] == 'L'){
        ans = "No";
        break;
      }
    }
    else{
      if(S[i] == 'R'){
        ans = "No";
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
// C.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;

typedef long long LL;
typedef long double LD;
const LL MOD = 1000000007;
const LD EPS = 1e-10;
static const size_t MAX_N = 1000001;

struct modll {
	long long x;
	modll() { }
	modll(int _x) : x(_x) { }
	operator int() const { return (int)x; }
	modll operator+(int y) { return (x + y + MOD) % MOD; }
	modll operator+=(int y) { x = (x + y + MOD) % MOD; return *this; }
	modll operator-(int y) { return (x - y + MOD) % MOD; }
	modll operator-=(int y) { x = (x - y + MOD) % MOD; return *this; }
	modll operator*(int y) { return (x * y) % MOD; }
	modll operator*=(int y) { x = (x * y) % MOD; return *this; }
	modll operator/(int y) { return (x * modpow(y, MOD - 2)) % MOD; }
	modll operator/=(int y) { x = (x * modpow(y, MOD - 2)) % MOD; return *this; }
	static modll modinv(int a) { return modpow(a, MOD - 2); }
	static modll modpow(int a, int b) {
		modll x = a, r = 1;
		for (; b; b >>= 1, x *= x) if (b & 1) r *= x;
		return r;
	}
};

modll combination(LL n, LL r) {
	static modll fact[MAX_N + 1], inv[MAX_N + 1];
	if (!fact[0]) {
		fact[0] = 1;
		for (int i = 1; i <= MAX_N; ++i) {
			fact[i] = fact[i - 1] * i;
		}
		inv[MAX_N] = modll::modinv(fact[MAX_N]);
		for (int i = MAX_N; i >= 1; --i) {
			inv[i - 1] = inv[i] * i;
		}
	}
	if (r > n) {
		return 0;
	}
	return (fact[n] * inv[r]) * inv[n - r];
}

int main(int argc, char* argv[]) {
	LL n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (LL i = 0; i < n; ++i) {
		cin >> a[i];
	}
	int mn = *min_element(a.begin(), a.end());
	for (LL i = 0; i < n; ++i) {
		a[i] -= mn;
	}
	sort(a.begin(), a.end());
	modll low = 0, high = 0;
	for (LL i = 0; i <= n - k; ++i) {
		low += combination(n - i - 1, k - 1) * a[i];
		high += combination(n - i - 1, k - 1) * a[n - i - 1];
	}
	modll ans = high - low;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 19248
#include<iostream>

using namespace std;

int main(){

	int n;
	int y, m, d;
	int yeardata[2][10] = {
		{20,19,20,19,20,19,20,19,20,19},
		{20,20,20,20,20,20,20,20,20,20}
	};
	int cnt;
	int f;

	cin >> n;

	for (int i = 0; i < n; i++){

		cin >> y >> m >> d;

		cnt = 0;
		while (y < 1000){

			if (y % 3 == 0) f = 1;
			else f = 0;

			if (d == yeardata[f][m-1]) d = 1, m++;
			else d++;
			if (m == 11) m = 1,y++;
			cnt++;
		}

		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<algorithm>
#include<functional>

using namespace std;

int main(){
	int n,a,b,kiji;
	int toppingu[1000];
	int besuto=0;
	cin>>n>>a>>b>>kiji;
	for(int i=0;i<n;i++){
		cin>>toppingu[i];
	}
	int all=kiji;
	sort(toppingu,toppingu+n,greater<int>());
	for(int i=0;i<=n;i++){
		besuto=max(besuto,(all)/(a+b*i));
		all+=toppingu[i];
	}
	cout<<besuto<<endl;
	return 0;
}

Measured memory_bytes: 1180
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 3e5 + 10, MOD = 1e9+7;
const ll OO = 2e18;
string val[] = { "Sunny", "Cloudy", "Rainy", "Sunny" };
int main() {
	
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); ++i) {
		if (i % 2 == 0) {
			if (s[i] == 'R' || s[i] == 'U' || s[i] == 'D')
				continue;
		}
		else {
			if (s[i] == 'L' || s[i] == 'U' || s[i] == 'D')
				continue;
		}
		cout << "No" << endl;
		exit(0);
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
int read()
{
	int out = 0, sgn = 1;
	char jp = getchar();
	while (jp != '-' && (jp < '0' || jp > '9'))
		jp = getchar();
	if (jp == '-')
		sgn = -1, jp = getchar();
	while (jp >= '0' && jp <= '9')
		out = out * 10 + jp - '0', jp = getchar();
	return out * sgn;
}
const int N = 1e5 + 10;
int n, a[N];
bool solve()
{
	a[n + 1] = 0;
	for (int i = 1; i <= n; ++i)
		if (a[i + 1] <= i && i <= a[i])
		{
			if (i == a[i])
			{
				int j = i;
				while (j + 1 <= n && a[j + 1] == a[i])
					++j;
				return (j - i) & 1;
			}
			else if (i == a[i + 1])
			{
				int t1 = (a[i] - i - 1) & 1;
				int j = i + 1;
				while (j + 1 <= n && a[j + 1] == a[i + 1])
					++j;
				int t2 = (j - i - 1) & 1;
				return !t1 || !t2;
			}
			else
			{
				int j = i;
				while (j + 1 <= n && a[j + 1] == a[i])
					++j;
				int t = (j - i) & 1;
				return t ^ ((a[i] - i) & 1);
			}
		}		 
	assert(false);
	return false;
}
int main()
{
	n = read();
	for (int i = 1; i <= n; ++i)
		a[i] = read();
	sort(a + 1, a + 1 + n);
	reverse(a + 1, a + 1 + n);
	if (solve())
		puts("First");
	else
		puts("Second");
	return 0;
}


Measured memory_bytes: 640
// C - Same Integers
#include <bits/stdc++.h>
using namespace std;

int main(){
	int A,B,C; cin>>A>>B>>C;
	int isodd = (A+B+C)&1;
	int ans = 0;
	if((A&1) != isodd){A++; ans=1;}
	if((B&1) != isodd){B++; ans=1;}
	if((C&1) != isodd){C++; ans=1;}
	int maxi = max({A,B,C});
	ans += (maxi-A)/2 + (maxi-B)/2 + (maxi-C)/2;
	cout<< ans <<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

typedef struct {
  char Kind;
  int Number;
} Card;

Card card[100000],card2[100000];

void quickSort(int,int);
int partition(int,int);

int main(){
  int n,i,j,c=0,t1=0,t2=0;
  
  scanf("%d",&n);
  
  for(i=0; i < n; i++){
    scanf(" %c%d",&card[i].Kind,&card[i].Number);
    card2[i] = card[i];
  }
  
  quickSort(0,n-1);

   for(i=1; i < n; i++){
     if(card[i-1].Number == card[i].Number){
      for(j=0; j < n; j++){
	if(card[i-1].Kind == card2[j].Kind && card[i-1].Number == card2[j].Number){
	  t1 = j;
	}
	if(card[i].Kind == card2[j].Kind && card[i].Number == card2[j].Number){
	  t2 = j;
	}
      }
      if(t1 > t2){
	  c++;
	  break;
      }
    }
  }
  
  for(i=0; i < n; i++){
    if(c == 0 && i == 0){
      printf("Stable\n");
    } else if(i == 0){
      printf("Not stable\n");
    }
    printf("%c %d\n",card[i].Kind,card[i].Number);
  }
  
  return 0;
}

void quickSort(int p,int r){
  int q;
  if(p < r){
    q = partition(p,r);
    quickSort(p,q-1);
    quickSort(q+1,r);
  }
}

int partition(int p,int r){
  Card C,c;
  int i=0,j=0;
  C.Number = card[r].Number;
  C.Kind = card[r].Number;
  i = p-1;
  for(j=p; j < r; j++){
    if(card[j].Number <= C.Number){
      i = i+1;
      c = card[i];
      card[i] = card[j];
      card[j] = c;
    }
  }
  c = card[i+1];
  card[i+1] = card[r];
  card[r] = c;
  return i+1;    
}




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

int main(){
	int n;
	cin>>n;
	for(int i=1;;i++){
		int cnt=0;
		for(int j=1;j<=i;j++){
			if(i%j==0)cnt++;
		}
		if(cnt==n){
			cout<<i<<endl;
			break;
		}
	}
	return 0;
}

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

typedef long long int lli;
typedef pair<lli,lli> pii;

int n,a,b=0;

int main(){
	scanf("%i",&n);
	for(int i=0;i<n;i++){
		scanf("%i",&a);
		if(a%2==1) b++;
	}
	if(b%2){
		printf("NO\n");
	} else {
		printf("YES\n");
	}
}

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

using namespace std;

// input
int a, b;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> a;
    cin >> b;

    cout << (a * b) - (a + b - 1) << "\n";
}

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

int main(){
    int i;
    long long r , d , x;
    scanf( "%lld%lld%lld" , &r , &d , &x );

    for( i = 1 ; i <= 10 ; ++i ){
        x = r * x - d;
        printf( "%lld\n" , x );
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
  int w,n;
  cin>>w>>n;
  vector<int>a(w);
  for(int i=0;i<w;i++)a[i]=i+1;

  for(int i=0;i<n;i++){
    int b,c;
    char d;
    cin>>b>>d>>c;
    swap(a[b-1],a[c-1]);
  }
  for(int i=0;i<w;i++)cout<<a[i]<<endl;

}

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

int main()
{
  int N, D;
  int X[10][10];
  cin >> N >> D;
  for(int i=0; i<N; ++i) {
    for(int j=0; j<D; ++j) {
      cin >> X[i][j];
    }
  }
  int cnt = 0;
  for(int i=0; i<N; ++i) {
    for(int j=i+1; j<N; ++j) {
      int dist = 0;
      for(int k=0; k<D; ++k) {
        dist += pow((X[i][k] - X[j][k]),2);
      }
      for(int l=1; l*l <= dist; l++) {
        if(l*l == dist) {
          ++cnt;
          break;
        }
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;



int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    char c;
    cin >> c;
    if(c >= 'a'  && c <= 'z') cout << 'a';
    else cout << 'A';

    return 0;
}



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

using namespace std;

typedef double ll;

struct Point
{
    ll x,y;
    Point(){ x = y = 0.0; }
    Point(ll _x, ll _y) : x(_x), y(_y){}

    Point operator+ (Point p)
    {
        return Point(p.x + x, p.y + y);
    }

    Point operator- (Point p)
    {
        return Point(x - p.x, y - p.y);
    }

    ll operator* (Point p)
    {
        return p.x * x + p.y * y;
    }

    Point operator* (ll t)
    {
        return Point(x*t, y*t);
    }

    ll operator~ ()
    {
        return sqrt(x * x + y * y);
    }

    ll operator% (Point p)
    {
        return x * p.y - y * p.x;
    }

};

bool areIntersectSegment(Point a, Point b, Point p, Point q)
{
    Point v1=(b-a);
    Point v2=(q-p);
    double t,t1;
    if( v1 % v2 != 0 )
    {
        t = (double)(( p - a ) % v2) / (double)(v1 % v2);
        t1 = (double)(( a - p ) % v1) / (double)(v2 % v1);
        if( t >= 0.0 && t <= 1.0 && t1 >= 0.0 && t1 <= 1.0) return true;
        else return false;
    }
    else
    {
        // Segment collinear
        if( v1 % v2 == 0 && (p - a) % v1 == 0 )
        {
            t = (double)((p - a)*v1) /  (double)(v1*v1);
            t1 = (double)((p+v2-a)*v1) / (double)(v1*v1);
            //If are in opposite direction
            if( v1 * v2 < 0 )
            {
                if( t1 <= 1.0 && 0.0 <= t ) return true;
            }
            else
            {
                if( t <= 1.0 && 0.0 <= t1 ) return true;
            }
        }
    }
    return false;
}

Point projection(Point p1, Point p2, Point o)
{
    Point a = (p2 - p1);
    Point b = (o - p1);
    double t =( (a * b) / (a * a) );
    if( t < 0.0 ) return p1;
    if( t > 1.0 ) return p2;
    return p1 + a * t;
}

double distancePointToSegment(Point a, Point b, Point p)
{
    return ~(projection(a,b,p)-p);
}

double distanceSegmentToSegment(Point a, Point b, Point p, Point q)
{
    double minimo = numeric_limits<double>::max();
    Point aux;
    if( !areIntersectSegment(a,b,p,q) )
    {
        minimo = min( minimo, distancePointToSegment(a,b,p) );
        minimo = min( minimo, distancePointToSegment(a,b,q) );
        minimo = min( minimo, distancePointToSegment(p,q,a) );
        minimo = min( minimo, distancePointToSegment(p,q,b) );
        return  minimo;
    }
    return 0.0;
}

int main()
{
    cout << fixed;
    cout.precision(10);
    ios::sync_with_stdio(0); cin.tie(0);
    Point p0,p1,p2,p3,ans;
    Point vec, vec1;
    int q;
    cin >> q;
    while(q--)
    {
        cin >> p0.x >> p0.y >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y;
        cout << distanceSegmentToSegment(p0, p1, p2, p3) << '\n';
    }
    return 0;
}

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

int main () {
  int n;
  cin >> n;
  
  int ans = 0;
  int i = 0;
  while (pow(2,i) <= n) {
    ans = pow(2,i);
    i++;
  }
  cout << ans << endl;
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using pi = pair<int,int>;

int MOD = 1e9+7;

// ll po(ll b, ll p){ return !p?1:po(b*b%MOD,p/2)*(p&1?b:1)%MOD;}
// ll pomd(ll a, ll k, ll md) { ll p; if (k == 0){ return 1; } p = pomd(a, k / 2, md); p = p * p % md; if (k % 2){ p = p * a % md; } return p; }
// vi arr(N); for(int i{1}; i<N; ++i) for(int j=i; j<N; j+=i) d[j]++; // counting divisors
//bool isPrime(ll n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for (ll i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; }

#define mp make_pair
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define rot(s, k) rotate(s.begin(), s.begin()+ s.size()-(k%s.size()), s.end()); //+ve = right, -ve = left

void setIO(string name = ""){
    freopen((name+".in").c_str(), "r", stdin); 
    freopen((name+".out").c_str(), "w", stdout);
}	

map<int, int> yes;

int main(){
 	ios_base::sync_with_stdio(0); cin.tie(0); 
	// setIO();
	int n; cin >> n;
	for(int i{1}; i<=n; ++i){
		int x; cin >> x;
		yes.insert(mp(x, i));
	}

	for(int i{1}; i<=n; i++){
		cout << yes[i] << " ";
	}


}


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



using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi             vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define tc            int testcases; cin>>testcases; while(testcases--)
#define set            set<int>
#define set1            set<int,greater<int>>
#define ub              upper_bound
#define lb              lower_bound
#define mset            multiset<int>
#define mset1           multiset<int,greater<int>>
#define dbg1(x)             cout <<#x<<": "<<x<<'\n';
#define dbg2(x, y)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<'\n';
#define dbg3(x, y, z)       cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<'\n';
#define dbg4(a, b, c, d)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<'\n';
#define dbg5(a, b, c, d, e) cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<'\n';



void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
}


// Driver Program to test above function

int32_t main()
{
	c_p_c();

	int n;
	cin >> n;
	vi a(n);

	for (int i = 0; i < a.size(); ++i)
	{	cin >> a[i];
		/* code */
	}
	int s = 0;

	for (int i = 1; i < a.size(); ++i)
	{	if (a[i] < a[i - 1])
		{
			s = s + a[i - 1] - a[i];
			a[i] = a[i - 1];
			/* code */
		}
	}
	cout << s << "\n";
	return 0;
}

Measured memory_bytes: 4776
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1'000'000'007;
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } return false; }

template<typename T>
vector<T> gen_v(size_t a) { return vector<T>(a); }
template<typename T, typename ...Ts>
auto gen_v(size_t a, Ts... ts) { return vector<decltype(gen_v<T>(ts...))>(a, gen_v<T>(ts...)); }
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T & t, const V & v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T & t, const V & v) { for (auto& e : t) fill_v(e, v); }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	vector<vector<int>> v(N, vector<int>(N));

	vector<int> d(N + 1, -1);

	int id = 0;
	rep(k, 1, N + 1) {
		if (d[k] == -1) {
			for (int i = k; i < N + 1; i += 2 * k) {
				d[i] = id;
			}
			id++;
		}
	}
	dump(d);

	rep(i, 0, N) {
		rep(j, i + 1, N) {
			v[i][j] = d[j - i];
		}
	}

	rep(i, 0, N) {
		rep(j, i + 1, N) {
			if (j != i + 1)cout << " ";
			cout << v[i][j] + 1;
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int n;
  cin >> n;
  vi a(n);
  int all = 0;
  REP(i, n) {
    cin >> a[i];
    all ^= a[i];
  }

  vector<bool> canUse(33, false);
  REP(i, n) {
    int tmp = a[i] ^ (a[i] - 1);
    int c = 0;
    while (tmp) {
      tmp /= 2;
      c++;
    }
    canUse[c] = true;
  }

  int ans = 0;

  while (all) {
    int tmp = all;
    int c = 0;
    while (tmp) {
      tmp /= 2;
      c++;
    }
    if (!canUse[c]) {
      cout << -1 << endl;
      return 0;
    }
    all ^= (1 << c) - 1;
    ans++;
  }
  cout << ans << endl;

}


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

const int maxn = 100 * 1000 + 20; 
int n, a[maxn];

bool solve(bool win) {
    int ha = 0, cnt[2] = {0, 0};
    for (int i = 0; i < n; i++) {
        cnt[a[i] % 2]++;
        if (a[i] == 1)
            ha++;
    }   
    if (cnt[0] % 2)
        return win;
    if (cnt[1] > 1)
        return !win;
    if (ha)
        return !win;
    int g = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] % 2)  
            a[i]--;
        g = __gcd(g, a[i]);
    }   
    for (int i = 0; i < n; i++)
        a[i] /= g;
    return (solve(!win));
}

int main() {
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    if (n == 1)
        return cout << "Second\n", 0;
    cout << (solve(1)? "First\n": "Second\n");
    return 0;
}


Measured memory_bytes: 4044
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();
    
    VI a(3); cin >> a;
    cout << (a[1] - a[0] == a[2] - a[1] ? "YES\n" : "NO\n");
}


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

#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define FOR(i, n, m) for(int (i) = (n); (i) < (m); ++(i))

constexpr int INF = 1e9;
//constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;


int main(){
  int S, W;
  cin >> S >> W;
  if(W >= S){
    cout << "unsafe" << endl;
  }
  else{
    cout << "safe" << endl;
  }

  return 0;
}


Measured memory_bytes: 3544
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<LP> vec;
typedef vector<string> svec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-8;

const ll mn = 1000000000000000000;
void solve() {
	ll s; cin >> s;
	ll x[3], y[3];
	if (mn - s <= 1000000000) {
		x[0] = y[0] = 0;
		x[1] = y[2] = 1000000000;
		x[2] = 1; y[1] = mn - s;
	}
	else {
		x[0] = y[0] = 0;
		ll k = sqrt(s + 0.01);
		ll d = (s + k - 1) / k;
		x[1] = k; y[2] = d;
		x[2] = 1; y[1] = k * d - s;
	}
	rep(i, 3) {
		if (i > 0)cout << " ";
		cout << x[i] << " " << y[i];
	}
	cout << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
	//stop
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,t[60],ans;
char a[60][110],x[110];
int main()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%s %d\n",a[i],&t[i]);
        ans+=t[i];
    }
    scanf("%s",x);
    for(int i=0;i<n;i++)
    {
        ans-=t[i];
        if(strcmp(a[i],x)==0)
        {
            break;
        }
    }
    printf("%d",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
vector<int> input(int N) {
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  return vec;
}

int main() {
  int n,k,count=0;
  cin >> n >> k;
  vector<int> v=input(n);
  rep(i,n){
    if(k<=v[i]){
      count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

bool ispal(string s) {
    ll len = s.size();
    bool ok = true;
    REP(i, 0, len) {
        if (s[i] != s[len - 1 - i]) {
            ok = false;
        }
    }
    return ok;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    bool ok = true;
    ll m = s.size() - 1 / 2;
    if (!ispal(s) || !ispal(s.substr(0, m)) || !ispal(s.substr((s.size() + 3) / 2 - 1, m))) {
        ok = false;
    }
    yesno(ok);
}


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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb push_back
#define mp make_pair

int main()
{
	int a,b,c;
	cin >> a >> b >> c;
	vector<int> v;
	v.pb(a);v.pb(b);v.pb(c);
	sort(ALL(v));
	YES(v[0] == 5 && v[1] == 5 && v[2] == 7);
	return 0;
}


Measured memory_bytes: 256
import itertools
import math
N = int(input())
# X1_list = [int(input()) for i in range(N)]
XY_list = [list(map(int,input().split())) for i in range(N)]
result = 0
for keiro in itertools.permutations(XY_list,N):
    for i in range(1,N):
        #print(keiro[i][0] - keiro[i-1][0], (keiro[i][1] - keiro[i-1][1]) ** 0.5)
        #print(keiro[i][0], keiro[i-1][0],keiro[i][1], keiro[i-1][1])
        #print(((keiro[i][0] - keiro[i-1][0]) ** 2 + (keiro[i][1] - keiro[i-1][1]) ** 2) ** 0.5)
        result += ((keiro[i][0] - keiro[i-1][0]) ** 2 + (keiro[i][1] - keiro[i-1][1]) ** 2) ** 0.5
print(result/math.factorial(N))


Measured memory_bytes: 3060
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
INF = float("inf")
import sys
sys.setrecursionlimit(10000)


# 初項a，交差dの数列n個の和
def arithmetic_series(a, d, n):
    return n * (2 * a + (n - 1) * d) // 2


def solve(A):
    ans = arithmetic_series(1, 1, len(A) - 1) + 1
    c = Counter(A)
    for v in c.values():
        ans -= (v * (v - 1)) // 2
    return ans


def main():
    A = input()
    print(solve(A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 4136
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    ll h;cin>>h;
    ll n;cin>>n;
    vector<ll> a(n);
    For(i,0,n) cin>>a[i];
    For(i,0,n){
        h-=a[i];
    }
    cout<<(h>0?"No":"Yes")<<endl;
}
int main(){
    Main();
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define fr first
#define se second
#define pb push_back
#define ll long long
#define TIME ios_base::sync_with_stdio(0);
using namespace std;
ll cnt, a , b , c , n , m , mx ,d , sum , temp , mx1;
const ll N = 1e4;
string s;
int main(){
    cin >> n >> s;
    for( int i = 0;i < n;i ++ ){
        if( s[i] == 'R' )
            a ++;
        if( s[i] == 'G' )
            b ++;
        if( s[i] == 'B' )
            c ++;
    }
    cnt = a * b * c;
    for( int i = 0;i < n;i ++ ){
        for( int j = 0;j * 2 + i < n;j ++ ){
            if( s[i] == 'R' and s[i + j] == 'G' and s[i + j * 2] == 'B' )
                cnt --;
            else if( s[i] == 'R' and s[i + j] == 'B' and s[i + j * 2] == 'G' )
                cnt --;
            else if(s[i] == 'B' and s[i + j] == 'R' and s[i + j * 2] == 'G' )
                cnt --;
            else if( s[i] == 'B' and s[i + j] == 'G' and s[i + j * 2] == 'R' )
                cnt --;
            else if( s[i] == 'G' and s[i + j] == 'B' and s[i + j * 2] == 'R' )
                cnt --;
            else if( s[i] == 'G' and s[i + j] == 'R' and s[i + j * 2] == 'B' )
                cnt --;
        }
    }
    cout << cnt;
}


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

using ll = long long;
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x) for (auto&& v : (x))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))

int main() {
  ll h, c = 1;
  cin >> h;
  ll result = 0;
  while (h > 0) {
    result += c;
    h /= 2;
    c *= 2;
  }
  cout << result << endl;
}


Measured memory_bytes: 3648
#include <cstdio>
#include<cstring>
#include <algorithm>
int h,n;
int v[1010],w[1010];
int dp[1010][100010]; //前i个，效果j,最小代价
void debug()
{
	puts("*************");
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=14;j++)
			printf("%8d",dp[i][j]==0x7f7f7f7f?-11:dp[i][j]);
		puts("");
	}
}
int main()
{
	// freopen("test.in","r",stdin);
	scanf("%d%d",&h,&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",v+i,w+i);
	int ans=0x7fffffff;
	memset(dp,0x7f,sizeof(dp));
	for(int i=0;i<=n;i++) dp[i][0]=0;
	for(int i=1;i<=n;i++)//第i个
	{
		for(int j=1;j<100010;j++)//效果
		{
			if(v[i]<=j) dp[i][j]=std::min(dp[i-1][j],dp[i][j-v[i]]+w[i]);
			else dp[i][j]=dp[i-1][j];
			if(j>=h)
			{
				ans=std::min(dp[i][j],ans);
			}
		}
		// debug();
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 394752
import sys
import itertools
import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

while 1:
    H, W = map(int, readline().split())
    if H == 0 and W == 0:
        break
    else:
        for i in range(H):
            if i==0 or i==H-1:
                Y = '#' * W
                print(Y)
            else:
                Y='.'*W
                YY='#'+Y[1:-1]+'#'
                print(YY)
    print()



Measured memory_bytes: 5708
s = input()
r1 = s[::-1]
n = len(s)
r2 = s[0:(n-1)//2]
r2r = r2[::-1]
r3 = s[(n+3)//2-1:]
r3r = r3[::-1]
if s == r1 and r2 == r2r and r3 == r3r:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner(os.Stdin)
	N := sc.NextInt()
	M := sc.NextInt()
	cnt := make([]int, M+1)
	for i := 0; i < N; i++ {
		K := sc.NextInt()
		for j := 0; j < K; j++ {
			a := sc.NextInt()
			cnt[a]++
		}
	}
	ans := 0
	for i := 1; i <= M; i++ {
		if cnt[i] == N {
			ans++
		}
	}
	fmt.Println(ans)
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

// scanner
type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner(r io.Reader) *Scanner {
	rdr := bufio.NewReaderSize(r, 1024)
	return &Scanner{r: rdr}
}

func (s *Scanner) ReadLine() {
	s.buf = make([]byte, 0)
	for {
		line, isp, err := s.r.ReadLine()
		if err != nil {
			os.Exit(1)
		}
		s.buf = append(s.buf, line...)
		if !isp {
			break
		}
	}
}

func (s *Scanner) NextInt() int {
	i, err := strconv.Atoi(s.Next())
	if err != nil {
		os.Exit(1)
	}
	return i
}

func (s *Scanner) NextFloat64() float64 {
	i, err := strconv.ParseFloat(s.Next(), 64)
	if err != nil {
		os.Exit(1)
	}
	return i
}

func (s *Scanner) Next() string {
	s.Pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	next := string(s.buf[start:s.p])
	s.p++
	return next
}

func (s *Scanner) Pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}

using namespace std;
//typedef long long ll;
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}

//配列のSIZEは問題ごとに定義する必要がある。
const int SIZE=200010;
const int MOD=i_7;
long long inv[SIZE+1];//各iの逆元を格納する配列。
long long kai[SIZE+1];//i!のmodを格納する配列。
long long invkai[SIZE+1];//各i!の逆元を格納する配列。
void invinit(){//上の配列を初期化する関数。
    inv[1]=1;
    for(int i=2;i<=SIZE;i++){
        inv[i] = MOD - ((MOD/i)*inv[MOD%i])%MOD;
    }
    
    kai[0]=invkai[0]=1;
    for(int i=1;i<=SIZE;i++){
        kai[i]=(kai[i-1]*i)%MOD;
        invkai[i]=(invkai[i-1]*inv[i])%MOD;
    }
}

long long comb(long long a, long long b){
    if(b<0 || a<b){
        return 0;
    }
    return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
}

int main(){
  long long h,w,a,b;
  cin>>h>>w>>a>>b;
  long long ans=0;
  
  invinit();
  for(long long i=0;i<h-a;i++){
    ans += mod(comb(b-1+i,b-1)*comb(h-i-1+w-b-1,w-b-1));
    ans = mod(ans);
  }
  cout<<ans<<endl;
  return 0;
}
  
  


Measured memory_bytes: 4992
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define str string
#define ld long double
#define vec vector
#define vll vec<ll>
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(ll i=b;i>=a;i--)
#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()
#define kai "\n"
#define yuque priority_queue
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mie min_element
#define mae max_element
#define tos to_string
#define sep setprecision
#define lob lower_bound
#define upb upper_bound
#define nep next_permutation
#define MOD 1000000007ll
#define MIN (1e-10)
#define equal(a,b) (abs((a)-(b))<MIN)
#define v2 ten
#define chokusen senbun
#define tenten senbun
#define takaku vec<ten>
using namespace std;
void solve();
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed;
	solve();
}
struct pea{
	ll f,s;
	bool operator<(const pea &p)const{
		return f!=p.f?f<p.f:s<p.s;
	};
};
struct tri{
	ll f,s,t;
	bool operator<(const tri &p)const{
		if(f!=p.f)return f<p.f;
		if(s!=p.s)return s<p.s;
		return t<p.t;
	};
};
class ten{
public:
	ld x,y;
	ten operator+(ten p){return{x+p.x,y+p.y};}
	ten operator-(ten p){return{x-p.x,y-p.y};}
	ten operator*(ld k){return{k*x,k*y};}
	ten operator/(ld k){return{x/k,y/k};}
	ld abs(){return sqrt(abs2());}
	ld abs2(){return x*x+y*y;};
	bool operator<(const ten &p)const{return x!=p.x?x<p.x:y<p.y;};
	bool operator==(const ten &p)const{return (-MIN<x-p.x)&&(x-p.x<MIN)&&(-MIN<y-p.y)&&(y-p.y<MIN);};
	ld naiseki(v2 b){return x*b.x+y*b.y;}
	ld gaiseki(v2 b){return x*b.y-y*b.x;}
};
struct senbun{ten p1,p2;};
struct en{ten o;ld r;};
ll n,k;vll w;
bool isok(ll key){
	ll j=0;
	rep(i,0,k){
		ll sum=0;
		while(j<n&&sum+w[j]<=key){
			sum+=w[j];
			j++;
		}
	}
	if(j==n)return true;
	return false;
}
ll minkey(ll lkey,ll rkey){
	while(lkey<rkey){
		ll mkey=(lkey+rkey)/2;
		if(isok(mkey))rkey=mkey;
		else lkey=mkey+1;
	}
	return lkey;
}
void solve(){
	cin>>n>>k;
	w.resize(n);
	rep(i,0,n)cin>>w[i];
	cout<<minkey(0,MOD)<<kai;
}


Measured memory_bytes: 3636
using System;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;

namespace NTL1_E
{
    class Program
    {
        static int a, b;
        static void Main(string[] args)
        {
            var t = scan;
            a = t[0]; b = t[1];
            var P = ExEuc();
            Console.WriteLine(P.Key + " " + P.Value);
        }
        static Pair ExEuc()
        {
            int r0 = a, r1 = b;
            int x0 = 1, x1 = 0;
            int y0 = 0, y1 = 1;

            while (r1 > 0)
            {
                int q = r0 / r1;
                int r2 = r0 % r1;
                int x2 = x0 - q * x1;
                int y2 = y0 - q * y1;

                r0 = r1; r1 = r2;
                x0 = x1; x1 = x2;
                y0 = y1; y1 = y2;
            }
            return new Pair(x0, y0);
        }
        
        static int[] scan { get { return Array.ConvertAll(Console.ReadLine().Split(), int.Parse); } }
    }
}

Measured memory_bytes: 9260