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

int main() {
  long N; cin >> N;
  int char_num = 0; long end_number = 1;
  while (end_number <= N) {
    end_number = end_number * 26 + 1;
    char_num++;
  }
  long begin_number = (end_number-1)/26;
  long length = end_number - begin_number;
  N -= begin_number;
  string S;
  for (int i = 0; i < char_num; i++) {
    S.push_back('a' + (N % 26));
    N /= 26;
  }
  reverse(S.begin(), S.end());
  cout << S << endl;
}

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

using namespace std;

void Solve(){
    string s;
    cin>>s;
    if(s[0] == '7' || s[1] == '7' || s[2] == '7') cout<<"Yes\n";
    else cout<<"No\n";

}
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int test_case = 1;
    //cin>>test_case;
    while(test_case--){
        Solve();
    }
}

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

using namespace std;

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

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

    int train = n * a;
    
    cout << min(train, b) << endl;

    return 0;
}

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

int main() {
	long a, b, c, d;

	cin >> a >> b >> c >> d;

	long long ans[4];

	ans[0] = a * c;
	ans[1] = b * d;
	ans[2] = a * d;
	ans[3] = b * c;

	long long max = -1000000000000000000;
	for(int i=0; i<4;i++){
		if(max < ans[i]) max = ans[i];
	}

	cout << max << endl;
	
	return 0;
  
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()

#define X first
#define Y second

using namespace std;
using ll = long long;
using P = pair<int, int>;

const double PI = 3.14159265358979;

ll ans[90090];

void solve()
{
  int h, w, d, inum;
  cin >> h >> w >> d;
  map<int, P> mp;
  for(int i = 1; i <= h; ++i) for(int j = 1; j <= w; ++j)
  {
    cin >> inum;
    mp[inum] = P(j, i);
  }

  for(int i = 1; i <= d; ++i)
  {
    P now_p = mp[i];
    ll cost = 0;
    int now = i + d;
    while(now <= h * w)
    {
      P next_p = mp[now];
      cost += abs(now_p.X - next_p.X) + abs(now_p.Y - next_p.Y);
      ans[now] = cost;
      now_p = next_p;
      now += d;
    }
  }

  int q, l, r;
  cin >> q;
  for(int i = 0; i < q; ++i)
  {
    cin >> l >> r;
    cout << ans[r] - ans[l] << endl;
  }
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 9952
from math import ceil
n,h = map(int,input().split())
lst = [list(map(int,input().split())) for _ in range(n)]
max_a = max([lst[i][0] for i in range(n)])
b = sorted(lst[i][1] for i in range(n))+[0]
for i in range(n-1,-1,-1):
    b[i] += b[i+1]
ans = 10**10
for i in range(n+1):
    hp = h-b[i]
    t = max(0, ceil(hp/max_a))
    t += n-i
    ans = min(ans, t)
print(ans)

Measured memory_bytes: 33452
#include <algorithm>
#include <iostream>
#include <string.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX_N 200000
using namespace std;

int main(void) {
  int N, K;
  cin >> N >> K;
  int M[MAX_N];
  memset(M, 0, sizeof(int) * N);
  rep(i, N) {
    int A;
    cin >> A;
    M[A]++;
  }
  sort(M, M + N + 1, greater<int>());
  int Ans = 0;
  for (int i = K; i < N; i++) {
    Ans += M[i];
  }
  cout << Ans << endl;
  return 0;
}

Measured memory_bytes: 1024
n,a,b,c=map(int,input().split())
l=[int(input()) for i in range(n)]
ans=10**9
for bit in range(4**n):
    v=[0]*n
    A,B,C=0,0,0
    cnt=0
    for i in range(n):
        v[i]=(bit>>2*i)&3 #
        if v[i]==1:
            if A!=0:
                cnt+=10
            A+=l[i]
        elif v[i]==2:
            if B!=0:
                cnt+=10
            B+=l[i]
        elif v[i]==3:
            if C!=0:
                cnt+=10
            C+=l[i]
    if A==0 or B==0 or C==0: #
        continue
    ans=min(ans,abs(a-A)+abs(b-B)+abs(c-C)+cnt)
print(ans)

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

int main()
{
	long long int i,j,n,c=0;
	cin>>n;
	long long int a[n],d[n],m=0;
	for(i=0;i<n;i++)
	cin>>a[i];
	for(i=0;i<n;i++)
	{  
	    if(a[i]>=a[i+1])
	    {
	        c++;
	    }
        else 
	    c=0;
	    d[i]=c;
	}
	sort(d,d+n);
	cout<<d[n-1];
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    LL N; cin >> N;
    LL ans = LINF;
    for(LL i = 1; i*i <= N; i++){
        if(N%i != 0) continue;

        ans = min(ans,(i+(N/i))-2);
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
typedef long long ll;
const ll INF = 1e10;
int main(){
    ll n, v;
    cin >> n >> v;
    ll a[4][n];
    rep(i,4)rep(j,n)cin >> a[i][j];
    vector<ll> b, c;
    rep(i,n)rep(j,n){
        b.push_back(a[0][i] + a[1][j]);
        c.push_back(a[2][i] + a[3][j]);
    }
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    
    ll r = 0;
    rep(i,b.size())r += upper_bound(c.begin(), c.end(), v - b[i]) - lower_bound(c.begin(), c.end(), v - b[i]);
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 18828
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <string>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(){
    ios::sync_with_stdio(false);
    int n,c=0;
    cin>>n;
    vector<int>a(2*n);
    for(int i=0;i<2*n;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    for(int i=0;i<n*2;i+=2){
        c+=min(a[i],a[i+1]);
    }
    cout<<c<<"\n";
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#define endl "\n"
typedef long long ll;
using namespace std;
void Lancer() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
bool isPrime(ll n){
	if (n == 2 || n == 3 || n == 5)
		return true;
	else if (n % 2 == 0 || n % 3 == 0 || n % 5 == 0 || n == 1)
		return false;
	else {
		for (int i = 5; i <= sqrt(n); i += 2){
			if (n%i == 0)
				return false;
		}
		return true;
	}
}

int frq[57];
int main(){
	Lancer();
	ll n, m, res , dis,indx=0,x,y;
	cin >> n >> m;
	vector<pair<int, int > > stud(n + 2), pnt(n + 2);
	for (int i = 0; i < n; i++)
		cin >> stud[i].first >> stud[i].second;
	for (int i = 0; i < m; i++)
		cin >> pnt[i].first >> pnt[i].second;

	for (int i = 0; i < n; i++){
		res = 1000000000000000000;
		for (int j = 0; j < m; j++){
			x = abs(stud[i].first - pnt[j].first);
			y = abs(stud[i].second - pnt[j].second);
			dis = x + y;
			if (dis < res){
				indx = j + 1;
				res = dis;
			}
		}
		cout << indx << endl;
	}
	//cout << endl;
	return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
 
int main() {
    string S, T;
    cin >> S >> T;
 
    //答えansを仮置きする。
    //これが十分に大きくないと不正解となるので、
    //この値なら絶対に正しい答えが出る、という値を仮置きすること
    int ans = T.size();
 
    //Sの何文字目から調べるかを全探索する
    for (int start = 0; start <= S.size() - T.size(); start++)
    {
        int diff = 0;
        for (int i = 0; i < T.size(); i++)
        {
            if (T[i] != S[start + i]) {
                diff++;
            }
        }
        ans = min(ans, diff);
    }
 
    cout << ans << endl;
}

Measured memory_bytes: 3564
#include<iostream>
#include <algorithm>
#include <string>
using namespace std;
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
typedef long long ll;
const int INF = numeric_limits<int>::max();
const int MOD = (1e9 + 7);


int main(){
  int N, M, c;
  cin >> N >> M;
  int a[M];
  bool broken[N+1] = {0};
  rep(i, M){
    cin >> c;
    broken[c] = true;
  }
  int dp[N+2];
  dp[0] = 1; dp[1] = 1;
  rep(i, N){
    if(broken[i+1])  dp[i+1] = 0;
    dp[i+2] = dp[i+1] + dp[i];
    dp[i+2] %= MOD;
  }
  cout << dp[N] << endl;
}

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

int main(){
    string S,T;
    cin >> S;//7文字
    cin >> T;//3文字

    int tmp, ans=T.size();
    for(int i = 0; i <= S.size() - T.size(); i++){//012,456
        tmp = 0; // リセット
        for(int j = 0; j < T.size(); j++){
            if(S[i+j] != T[j]){//iから起点
                tmp = tmp + 1;
            }
        }
        ans = min(ans,tmp);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3632
//コンパイラ最適化用
#pragma GCC optimize("O3")
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

signed main(){
  int n, x, t;
  int ans;
  cin >> n >> x >> t;
  ans = (n / x)*t;
  if(n % x != 0){
    ans += t;
  }
  cout << ans;
}



Measured memory_bytes: 3592
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var nm = IO.RSLong;
            var n = nm[0];
            var m = nm[1];

            if (n >= m / 2)
            {
                WriteLine(m / 2);
            }
            else
            {
                long cnt_Scc = n;
                m -= n * 2;
                cnt_Scc += m / 4;
                WriteLine(cnt_Scc);
            }
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

Measured memory_bytes: 19084
import java.util.Scanner;

public class Main {

    public static void main(final String[] args) {

        try (final Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            String S = sc.next();
            int K = sc.nextInt();
            char kc = S.charAt(K - 1);
            StringBuilder builder = new StringBuilder();
            for (int i = 0; i < S.length(); i++) {
                char c = S.charAt(i);
                builder.append(c == kc ? c : "*");
            }
            System.out.println(builder);
        }
    }

}


Measured memory_bytes: 21204
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,int> pint;
typedef long long ll;
const int inf   = 1<<30;
const ll  longinf = 1LL<<60;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};
ll gcd(ll x,ll y){
  if(x<y) swap(x,y);
  if(x%y==0) return y;
  ll z=x%y;
  gcd(y,z);
  }
ll lcm(ll x,ll y){
  ll z=y/gcd(x,y);
  return x*z;
  }
int main(){
  int n;
  cin>>n;
  ll a[n];
  rep(i,n) cin>>a[i];
  ll ans=1;
  rep(i,n)
    ans=lcm(ans,a[i]);
  cout<<ans<<endl;
  return 0;
  }



Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]
b = [abs(aa) for aa in a]
b.sort()
plus_a = len([aa for aa in a if aa > 0])
zero_a = a.count(0)
minus_a = n - plus_a - zero_a
if minus_a % 2 == 0:
    ans = sum(b)
else:
    ans = sum(b[1:]) - b[0]
print(ans)

Measured memory_bytes: 14412
n, k = map(int, input().split()) ###n:モンスターの数，k:必殺技の回数
h=sorted(list(map(int,input().split()))) ###h:モンスターの体力

if n<=k:
    print(0)
elif k==0:
    b=sum(h)
    print(b)
else:
    a=sum(h[:-k])
    print(a)


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


int two_gcd(int i, int j){

    if(i < j) swap(i,j);

    int rem = 100100;

    while(rem != 0){
       rem = i % j;
       i = j;
       j = rem;
    }
    return i;
}
 
int gcd(int i, int j, int k){
    return two_gcd(two_gcd(i,j),k);
}
int main(){
    int n;
    cin >> n;

    long long sum = 0;

    rep(i,n) rep(j,n) rep(k,n){
        sum += gcd(i,j,k); 
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
string S;

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

  cin >> S;
  rep(i, S.size()) cout << 'x';

  return 0;
}

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

int func (int n);

int main () {

    int D, N;
    cin >> D >> N;

    int cnt = 0;

    for (int n = 1;; n++) {
        if (func(n) == D) cnt++;
        if (cnt == N) {
            cout << n << endl;
            break;
        }
    }

    return 0;
}

int func (int n) {

    if (n % 100 != 0) return 0;
    return func(n/100) + 1;
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int a = ri();
	int b = ri();
	int c = ri();
	int d = ri();
	while (a > 0 && c > 0) {
		c -= b;
		a -= d;
	}
	puts(c <= 0 ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 3772
K,N=input().split()
A=input().split()
n=0
m=1
S=list()
for i in range(int(N)-1):
  S.append(int(A[n+1])-int(A[n]))
  n=n+1
S.append(int(A[0])+(int(K)-int(A[-1])))

ans=int(K)-int(max(S))
print(ans)

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

int main()
{
	int N, T[101], M, P[101], X[101],sum=0,p[101];
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> T[i];
		sum += T[i];
	}
	cin >> M;
	for (int i = 1; i <= M; i++) {
		cin >> P[i] >> X[i];
	}
	for(int i = 1; i <= M; i++ ) {
		p[i] = sum - T[P[i]] + X[i];
		cout << p[i] << endl;
	}
		return 0;
	}

Measured memory_bytes: 256
#include <climits>
#include <cmath>
#include <algorithm>
#include <array>
#include <iostream>
#include <vector>
using namespace std;
int main(int, char**)
{
	long L, R;
	cin >> L >> R;
	if (R - L > 2018)
	{
		R = L + 2018;
	}
	long result = LONG_MAX;
	for (long i = L; i <= R; ++i)
	{
		for (long j = i + 1; j <= R; ++j)
		{
			result = min(result, (i * j) % 2019);
		}
	}
	cout << result << endl;
	return 0;
}


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

int main()
{
    string s; cin >> s;
    long long int sum=0;
    for(long long int i=0;i<s.size();i++)
    {
        sum=sum+(s[i]-'0');
    }
    if(sum%9==0)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
}

Measured memory_bytes: 3748
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt();
   		int B = sc.nextInt();
		int C = sc.nextInt();

		if(A+B+C>=22){
      System.out.println("bust");
        }else{
      System.out.println("win");          
    }
}
}

Measured memory_bytes: 22612
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
 
int main() {
	string a;
	cin >> a;
	int count=0;
	for (int i = 0; i <a.size() && (i < a.size() -i -1);i++) {
		if (a[i] != a[a.size() -i-1]) {
			count ++;
		}
	}
	cout << count <<endl;
	return 0;
}


Measured memory_bytes: 256
import static java.lang.Math.*;
import static java.util.Arrays.*;
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		try {
			String packageName = new Main().getClass().getPackage().getName();
			System.setIn(new FileInputStream("src/" + packageName + "/input.txt"));
			// System.setOut(new PrintStream(new FileOutputStream("src/" + packageName + "/result.txt")));
		} catch (FileNotFoundException e) {
		} catch (NullPointerException e) {
		}
		new Main().run();
	}

	void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	Scanner sc;
	void run() {
		sc = new Scanner(System.in);
		int T = sc.nextInt();
		while (T -- > 0) solve();
	}
	void solve() {
		char[] ds = sc.next().toCharArray();

		int i = 0;
		int turn = 0;
		int cur = 0;
		while (true) {
			if (cur >= 10) {
				turn++;
				cur = (cur / 10) + (cur % 10);
			} else {
				if (i == ds.length) break;
				cur += ds[i++] - '0';
				turn++;
			}
		}
		System.out.println(turn % 2 == 1 ? "Audrey wins." : "Fabre wins.");
	}
}

Measured memory_bytes: 12000
N = gets.to_i
A = gets.chomp.split.map(&:to_i)
Q = gets.to_i
ary = Q.times.map{gets.split.map(&:to_i)}
h = Array.new(10**5+1, 0)
A.each do |e|
  h[e] += 1
end


ans = A.sum

(0..Q-1).each do |i|
  x = ary[i][0]
  y = ary[i][1]
  ans += h[x]*(y-x)
  puts ans
  h[y] += h[x]
  h[x] = 0
end


Measured memory_bytes: 23044
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
from collections import deque
import sys
def main(H, W, C, D, S):
    INF = 10**6
    dist = [[INF] * W for _ in range(H)]
    di, dj = D
    dist[di][dj] = 0
    q = deque([(di, dj, 0)])
    while q:
        i, j, d = q.popleft()
        if d > dist[i][j]: continue
        for ni, nj in [(i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)]:
            if 0 <= ni < H and 0 <= nj < W and S[ni][nj] == '.':
                if dist[ni][nj] > d:
                    dist[ni][nj] = d
                    q.appendleft((ni, nj, d))
        for ni in range(i - 2, i + 2 + 1, 1):
            if not(0 <= ni < H): continue
            dni = dist[ni]
            sni = S[ni]
            for nj in range(j - 2, j + 2 + 1, 1):
                if 0 <= nj < W and sni[nj] == '.':
                    if dni[nj] > d + 1:
                        dni[nj] = d + 1
                        q.append((ni, nj, d + 1))

    ans = dist[C[0]][C[1]]
    print(ans if ans < INF else -1)


if __name__ == '__main__':
    input = sys.stdin.readline
    H, W = map(int, input().split())
    C = tuple(map(lambda x: int(x) - 1, input().split()))
    D = tuple(map(lambda x: int(x) - 1, input().split()))
    S = [list(input().rstrip()) for _ in range(H)]
    main(H, W, C, D, S)


Measured memory_bytes: 141688
from enum import Enum
from queue import Queue
import collections

import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

d=set()
for _ in range(int(input())):
    a,b=input().split()
    if a == 'find':
        if b in d:
            print('yes')
        else:
            print('no')
    else:
        d.add(b)



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

int main() {
	ll int n,i,j,k;
	cin>>n;
	ll ans = 0;
	for(i = 1; i <= n;i++)
	{
		for(j = 1; j <= n;j++)
		{
			for(k = 1; k <= n;k++)
			{
				ans += __gcd( i, __gcd(j,k));
			}
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int i=0,j,c=0,p,h[1000010],m=1,max=0;
    int n;
    cin >> n;
    for(i=1;i<=n;i++)
    {
        if(i%2!=0)
        {
            for(j=1;j<=i;j++)
            {
                if(i%j==0)
                {
                    c++;
                }
            }
            if(c==8)
            {
                max++;
            }
            c=0;
        }
    }
    cout << max << endl;
    
    return 0;

}


Measured memory_bytes: 3632
#include <stdio.h>

int main (void){

  int a, b, c, d;
  scanf("%d" ,&a);
  b=a/3600;
  c=(a-b*3600)/60;
  d=(a-b*3600)%60;
  printf("%d:%d:%d\n",b ,c ,d);
  


  return 0;
  }

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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))   //最大値を求める
#define MIN(x) *min_element(ALL(x))   //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007      //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

//for (auto& e : array)



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

    cout << A*B << endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define per(i, a, b) for (int i = a; i >= b; i--)
#define ll long long
#define mset(s, _) memset(s, _, sizeof s)
#define ALL(a) (a).begin(), (a).end()
using namespace std;

int main(void) {
  int n;
  cin >> n;
  vector<int> A;
  rep(i, 1, n) {
    int a;
    cin >> a;
    A.push_back(a);
  }

  sort(ALL(A));

  ll ans = 0;

  rep(i, 1, n - 1) { ans += A[n - (i / 2) - 1]; }

  cout << ans << endl;

  return 0;
}


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split().Select(int.Parse).ToArray();

            BubbleSort(A, N);
        }

        static void BubbleSort(int[] A, int N)
        {
            var flag = true;
            var count = 0;
            while (flag)
            {
                flag = false;
                for (var j = N - 1; j >= 1; j--)
                {
                    if (A[j] < A[j - 1])
                    {
                        count++;
                        var tmp = A[j];
                        A[j] = A[j - 1];
                        A[j - 1] = tmp;
                        flag = true;
                    }
                }
            }

            Console.WriteLine(string.Join(" ", A));
            Console.WriteLine(count);
        }
    }
}



Measured memory_bytes: 20352
#include<bits/stdc++.h>
using namespace std;
#define     debug       printf("\n<<CameHere<<\n")
#define     mem(x,y)    memset(x, y, sizeof(x))
#define     all(qz)     qz.begin(),qz.end()
#define     rall(qz)    qz.rbegin(),qz.rend()
#define     inf         LONG_LONG_MIN
#define     INF         LONG_LONG_MAX
#define     mod         1000000007
#define     Sqr(x)      ((x)*(x))
#define     ll          long long
#define     mk          make_pair
#define     pb          push_back
#define     pi          acos(-1.0)
#define     cos(a)      cos(a*pi/180)
#define     sin(a)      sin(a*pi/180)
#define     tan(a)      tan(a*pi/180)



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    ll n;
    cin>>n;
    ll lim=1e18;
    vector<ll> v(n);
    bool flag=false;
    for(ll i=0;i<n;i++){
        cin>>v[i];
        if(v[i]==0) flag=true;
    }
    if(flag){
        cout<<0<<endl;
        return 0;
    }
    ll ans=1;
    for(ll i=0;i<n;i++){
        double x=(double)lim/(double)ans;
        if(v[i]>x){
            flag=true;
            break;
        }
        else ans=ans*v[i];
        if(ans>lim){
            flag=true;
            break;
        }
    }
    if(flag) cout<<-1<<endl;
    else cout<<ans<<endl;
    return 0;
}


















Measured memory_bytes: 3972
import math
A,B=map(int,input().split())
Ra,Rb = math.ceil(A/0.08), math.ceil(B/0.1)
if Ra == Rb:
  print(Ra)
  exit()
if Ra < Rb:
  if math.floor(Rb*0.08) == A:
    print(Rb)
  else:
    print(-1)
  exit()
else:
  if math.floor(Ra*0.1) == B:
    print(Ra)
  else:
    print(-1)
  exit()
print(-1)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
	int a;
	int c=0;
	int d=0;
	int e=0;
	int f=0;
	int g=0;
	cin>>a;
	vector<string> b(a);
	for(int i=0;i<a;i++){
		cin>>b.at(i);
	}
	for (int i = 0; i < a; ++i){
		if(b.at(i).at(0)=='M')
			c++;
		if(b.at(i).at(0)=='A')
			d++;
		if(b.at(i).at(0)=='R')
			e++;
		if(b.at(i).at(0)=='C')
			f++;
		if(b.at(i).at(0)=='H')
			g++;
	}
cout<<c*d*e+c*d*f+c*d*g+c*e*f+c*e*g+c*f*g+d*e*f+d*e*g+d*f*g+e*f*g<<endl;
}

		

Measured memory_bytes: 6144
#include<bits/stdc++.h>
using namespace std;
#define int long
const int mod = 1000000007;
int gcd(int m,int n){return n?gcd(n,m%n):m;}
int lcm(int m,int n){return m/gcd(m,n)*n;}
signed main(){
  int n;
  cin>>n;
  vector<int> x(n);
  for(auto& i:x)cin>>i;
  vector<int> a(n),d(n),f(n);
  f[1]= a[1] = 1;
  for(int i=2;i<n;++i) f[i] = i*f[i-1]%mod;
  for(int i=1;i+1<n;++i) a[i+1] = ((i+1)*a[i]%mod+f[i])%mod;
  for(int i=1;i<n;++i) d[i] = x[i] - x[i-1];
  int res=0;
  for(int i=1;i<=n-2;++i){
    res = (res + a[i]*d[i]%mod)%mod;
    res = (res*(i+1))%mod;
  }
  res = (res + a[n-1]*d[n-1]%mod)%mod;
  cout<<res;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <queue>
#include <cmath>
#include <iomanip>
#include <cstdlib>
// #include <fstream>
 
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; }
 
const long long mod = 1e9 + 7;
 
int main()
{
    int n; std::cin >> n;

    for(int i=1; i<=n; i++)
    {
        if(n == floor(i*1.08))
        {
            std::cout << i << std::endl;
            return 0;
        }
    }
    std::cout << ":(" << std::endl;
    
    return 0;
}

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

int main() {
    int N, L;
    cin >> N >> L;
    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }

    int idx = -1;
    for (int i = 0; i < N - 1; i++) {
        if (a[i] + a[i + 1] >= L) {
            idx = i;
            break;
        }
    }
    if (idx == -1) {
        cout << "Impossible" << endl;
        return 0;
    }

    vector<int> ans;
    for (int i = 0; i < idx; i++) {
        ans.push_back(i);
    }
    for (int i = N - 2; i >= idx + 1; i--) {
        ans.push_back(i);
    }
    ans.push_back(idx);

    cout << "Possible" << endl;
    for (int as : ans) {
        cout << as + 1 << endl;
    }
}


Measured memory_bytes: 1784
#include<bits/stdc++.h>
#define ll unsigned long long int
using namespace std;
int main(){
    ll n; cin>>n;
    if(n==1) { cout<<1<<endl; return 0;}
    ll s=1,p=1;
    while(true){
    n=n/2;
    s+=(p*2);
    p=p*2;
    if(n==1 || n<1) { break; }
    }
    cout<<s<<endl;
    return 0;
}


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

int main(){
    double x1,x2,y1,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    
    double r2 = pow(x2-x1,2) + pow(y2-y1,2);
    double r = sqrt(r2);
    
    cout << fixed << setprecision(5) << r << endl;
    return 0;
}


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

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <map>

using namespace std;

typedef pair<int,int> Paint;
#define rep(i,q) for(int i = 0; (q) > i; i++)

int par[100010];
void init(int n){
  rep(i,n)par[i] = i;
}
int root(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = root(par[x]);
  }
}

bool same(int a, int b){
  return root(a) == root(b);
}

void unite(int a, int b){
  a = root(a);
  b = root(b);
  if(a == b)return;
  par[a] = b;
}

bool Pairsecond(const Paint& pf,Paint&ps){//sortCompare
  return pf.second < ps.second;
}

#define anyfill(n,s) setw(n) << setfill(s)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define pb push_back
#define MAX 1000000000
#define MOD 1000000007


/*
確認ポイント
to_string() はC++11以降の実装;
cout<< (char)数値 //数値にあった文字に置き換えられる
cout<< (double)int型/(2など)//小数になる
length(),size()に括弧をつけ忘れてないか;
sort()が使える型//vector,string...
大文字小文字間違えてないか
cout << fixed << 小数計算//正しい小数表記になる(基本6桁)(e記法回避にも使える)
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
sqrt(数値型)でrootが取れる
vector.unique()は隣接した同じ要素を削除するので先にソートをする
*/
int main() { 
  int n,m;cin>>n>>m;
  init(n+1);
  for(int i = 0; m > i; i++){
    int x,y,z;cin>>x>>y>>z;
    unite(x,y);
  }
  vector<int> eqal;
  for(int i = 1; n >= i; i++){
    eqal.push_back(root(par[i]));
  }
  sort(eqal.begin(),eqal.end());
  eqal.erase(unique(eqal.begin(), eqal.end()), eqal.end());
  cout << eqal.size() << endl;
  return 0;
}




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

int main() {
    int n;
    cin >> n;
    vector<ll int> dp(n+1, 0);
    vector<int> h(n+1, 0);
    rep(i, n) cin >> h[i+1];

    dp[2] = abs(h[1]-h[2]);

    for(int i = 3; i <= n; ++i) {
        dp[i] = min(dp[i-2] + abs(h[i]-h[i-2]), dp[i-1] + abs(h[i]-h[i-1]));
    }

    // rep(i,n+1) cout << i+1 << " " << dp[i+1] << endl;

    cout << dp[n] << endl;
}


Measured memory_bytes: 4228
#include <bits/stdc++.h>
#define show(x) std::cerr << #x << " = " << (x) << std::endl
using ll = long long;
template <typename T>
constexpr T MOD = static_cast<T>(1000000007);
template <typename T>
constexpr T INF = std::numeric_limits<T>::max() / 16;
int main()
{
    int N;
    std::cin >> N;
    using P = std::pair<ll, ll>;
    std::vector<P> A(N);
    for (int i = 0; i < N; i++) { std::cin >> A[i].first >> A[i].second; }
    std::sort(A.begin(), A.end(), [](const P& p1, const P& p2) { return p1.first + p1.second > p2.first + p2.second; });
    ll ans = 0;
    for (int i = 0; i < N; i++) { ans += (i % 2 == 0 ? A[i].first : -A[i].second); }
    std::cout << ans << std::endl;
    return 0;
}

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

#define MAX (1000)

int main(void)
{
	int sp;
	char stack[MAX];
	char str[MAX + 1];
	while (1){
		int i;

		fgets(str, MAX, stdin);
		if (str[0] == '.'){
			break;
		}

		if (str[strlen(str) - 1] == '\n'){
			str[strlen(str) - 1] = '\0';
		}

		sp = 0;
		for (i = 0; str[i] != '\0'; i++){
			if (str[i] == '[' || str[i] == '('){
				stack[sp++] = str[i];
			}
			else if (str[i] == ')' || str[i] == ']'){
				if (sp == 0){
					break;
				}
				char top = stack[--sp];
				if (top == '['){
					top = ']';
				}
				else {
					top = ')';
				}
				if (top != str[i]){
					break;
				}
			}
		}
	
		
		if (i != 0 && str[i] == '\0' && str[i - 1] == '.' && sp == 0){
			puts("yes");
		}
		else {
			puts("no");
		}
	}

	return (0);
}

Measured memory_bytes: 924
#include<iostream>
#include<stdio.h>
#include<string>
#include<cmath>
#include<math.h>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<unordered_map>
#pragma warning(disable: 4996)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define PI 3.141592653589793

using namespace std;
using ll = long long;

const int D = 60;
int to[D][200060];

int main() {

	int n; ll k;
	cin >> n >> k;
	vector<int> a(n);

	rep(i, n) {
		cin >> a[i];
		--a[i];
		to[0][i] = a[i];
	}

	rep(j, D - 1) {
		rep(i, n) {
			to[j+1][i] = to[j][to[j][i]];
		}
	}
	int ans = 0;
	for (int i = D - 1; i >=0; i--) {
		ll x = 1ll << i;
		if (k >= x) {
			
			ans = to[i][ans];
			k -= x;
		}
	}
	cout << ans + 1 << endl;
	return 0;
}

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

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

    int ans = 0;
    for (size_t i = a; i <= b; i++)
    {
        if (c % i == 0)
        {
            ans++;
        }
    }

    cout << ans << endl;
}



Measured memory_bytes: 3096
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m;
    cin >> n; 
    cin >> m;
    vector<int> P(n);
    for (int i = 0; i < n; ++i) {
        cin >> P[i];
        --P[i];
    }
    vector<int> X(m);
    vector<int> Y(m);
    for (int i = 0; i < m; ++i) {
        cin >> X[i] >> Y[i];
        --X[i], --Y[i];
    }
    
    vector<vector<int>> graph(n);
    for (int i = 0; i < m; ++i) {
        graph[X[i]].push_back(Y[i]);
        graph[Y[i]].push_back(X[i]);
    }
    vector<int> clock(n, 0);
    
    int res = 0;
    int clk = 0;
    for (int i = 0; i < n; ++i) {
        if (clock[i] == 0) {
            vector<int> que;
            que.push_back(i);
            clock[i] = ++clk;

            for (int j = 0; j < que.size(); ++j) {
                int u = que[j];
                for (auto v : graph[u]) {
                    if (clock[v] == 0) {
                        clock[v] = clk;
                        que.push_back(v);
                    }
                }
            }


            for (auto x : que) {
                if (clock[P[x]] == clk) {
                    ++res;
                }
            }
        }
    }

    cout << res << '\n';


    return 0;
}

Measured memory_bytes: 7932
#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include <stdlib.h>
using namespace std;
#define         rep(i,n)       for (int i = 0;i<(int)(n);i++)
#define         rep1(i,n)      for (int i = 1;i<=(int)(n);i++)
#define         sajo(str)      sort(str.begin(),str.end())
#define         rsajo(str)     reverse(str.begin(),str.end())
#define         pi             3.14159265359
#define         neli            printf("\n")
#define         gcd(a,b)       __gcd(a,b)
#define         lcm(a,b)       (a/gcd(a,b))*b
#define         yes            cout<<"Yes"<<"\n"
#define         no             cout<<"No"<<"\n"
#define         pf             printf
#define         sf             scanf
#define         pb             push_back
#define         ppb            pop_back
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 2e5+5;
typedef long long int         lli;
typedef long long             ll;
typedef unsigned long long    ull;
typedef double                db;
typedef long double           ldb;

int pos(int arr[], int n, int x)
{
    int i;
    for (i = 1; i <= n; i++)
        if (arr[i] == x)
            return i;
}

int main()
{
    FIO;
    ll a,b,x,y,ans,q,n,i,j;

    string s,t;
    cin>>a>>b;
    cout<<lcm(a,b)<<endl;

    return 0;

}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(void){
  int array[128];
  int n,i;
 
  scanf("%d",&n);
  for(i=0;i<n;i++)  scanf("%d",&array[i]);
  for(i=n-1;i>=1;i--)  printf("%d ",array[i]);
  printf("%d\n",array[0]);
 
  return 0;
}

Measured memory_bytes: 596
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] letters = sc.nextLine().split("");
		HashMap<String,Integer> pairs = new HashMap<String,Integer>();
		for(String l : letters){
			if(pairs.containsKey(l))
				pairs.replace(l, pairs.get(l)+1);
			else{
				pairs.put(l, 1);
			}
		}
		boolean beau = true;
		for(Map.Entry<String,Integer> m : pairs.entrySet()){
			if(m.getValue()%2 != 0){
				System.out.println("No");
				beau = false;
				break;
			}
		}
		if(beau)
			System.out.println("Yes");
	}

}


Measured memory_bytes: 9940
import java.util.Scanner;

public class Main {

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

		int A=Integer.parseInt(N.substring(0,1));
		int B=Integer.parseInt(N.substring(1,2));
		int C=Integer.parseInt(N.substring(2,3));
		int D=Integer.parseInt(N.substring(3,4));


		if (A + B + C + D == 7) {
			System.out.println(A + "+" + B + "+" + C + "+" + D+ "=7");
		}

		else if (A - B + C + D == 7) {
			System.out.println(A + "-" + B + "+" + C + "+" + D+ "=7");
		} else if (A + B - C + D == 7) {
			System.out.println(A + "+" + B + "-" + C + "+" + D+ "=7");
		} else if (A + B + C - D == 7) {
			System.out.println(A + "+" + B + "+" + C + "-" + D+ "=7");


		} else if (A - B - C + D == 7) {
			System.out.println(A + "-" + B + "-" + C + "+" + D+ "=7");
		} else if (A + B - C - D == 7) {
			System.out.println(A + "+" + B + "-" + C + "-" + D+ "=7");
		}else if (A - B + C - D == 7) {
			System.out.println(A + "-" + B + "+" + C + "-" + D+ "=7");
		}

		else if (A - B - C - D == 7) {
			System.out.println(A + "-" + B + "-" + C + "-" + D+ "=7");
		}
	}

}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;



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

	int N;
	cin >> N;

	vector<int> A(N);
	rep(i, N) {
		cin >> A[i];
		if (A[i] % 2 == 0) {
			if (A[i] % 3 == 0 || A[i] % 5 == 0) {
				continue;
			}
			else {
				cout << "DENIED" << endl;
				return 0;
			}
		}
	}

	cout << "APPROVED" << endl;


	return 0;
}


Measured memory_bytes: 256
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
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;}

int a,b;
inline void solve(){
  IN2(a,b);
  OUT(a*b%2?"Odd":"Even");
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


Measured memory_bytes: 256
from collections import defaultdict

n = int(input())

a_list = [int(x) for x in input().split()]

l = defaultdict(int)
r = defaultdict(int)
for i in range(n):
    l[i + a_list[i]] += 1
    r[i - a_list[i]] += 1

ans = 0
for x in l.keys():
    ans += l[x] * r[x]
print(ans)

Measured memory_bytes: 73944
import sys

n,k=map(int,input().split())
s=input()

lcnt=-1
rcnt=-1

rr=[0]*n
ll=[0]*n
sim=""
for si in s:
    if si=="R" and sim=="R":
        rr[rcnt]+=1
    elif si=="R" and sim!="R":
        rcnt+=1
        rr[rcnt]=1
    if si=="L" and sim=="L":
        ll[lcnt]+=1
    elif si=="L" and sim!="L":
        lcnt+=1
        ll[lcnt]=1
    sim=si
        
ll=[i for i in ll if i!=0]
rr=[i for i in rr if i!=0]
#print(ll)
#print(rr)

minlen=min(len(ll),len(rr))
if minlen<=k:
    print(n-1)
    sys.exit()
    
for i in range(k):
    ll[i]+=rr[i]
    rr[i]=0

for i in range(len(ll)-1):
    if i<len(rr) and ll[i]!=0 and rr[i]==0 :
        ll[i+1]+=ll[i]
        ll[i]=0

icnt=0
for i in range(len(ll)):
    icnt+=max(ll[i]-1,0)
for i in range(len(rr)):
    icnt+=max(rr[i]-1,0)
    
print(icnt)


Measured memory_bytes: 11100
#include <iostream>

using namespace std;

int main()
{
	int member;
	int kaisuu;
	int target[101];
	int score[101] = {0};
	int i, j;
	int num[101][101];
	
	cin >> member;
	cin >> kaisuu;
	
	for (i = 1; i <= kaisuu; i++){
		cin >> target[i];
	}
	for (i = 1; i <= kaisuu; i++){
		for (j = 1; j <= member; j++){
			cin >> num[i][j];
		}
		for (j = 1; j <= member; j++){
			if (target[i] == num[i][j]){
				score[j]++;
			}
			else {
				score[target[i]]++;
			}
		}
	}
	
	for (i = 1; i <= member; i++){
		cout << score[i] << endl;
	}
	
	return (0);
}

Measured memory_bytes: 3116
function main(input) {
  var args = input.trim().split(" ");
  var k = parseInt(args[0], 10);
  var x = parseInt(args[1], 10);
  var k = 500 * k;
  if ( k >= x ) {
    return "Yes";
  } else {
    return "No";
  }
}
console.log(main(require('fs').readFileSync('/dev/stdin', 'utf8')));

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

int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int score = 0;
  rep(i,n-1) {
    if (s[i] == s[i+1]) score++;
  }
  score = min(score+2*k, n-1);
  cout << score << endl;
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#include<bits/stdc++.h>
#define ld long double
#define ll long long int
#define ull unsigned long long intS
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
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;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;


int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
    string s;
    
    cin >> s;
    
    int x=0;
    
    for (int i=0;i<4;i++){
    
    if (s[i] == '+'){
    
    x += 1;
    
    }else{
    
    x -= 1;
    
    }
    
    
    }
    
    cout <<x << endl;
    
//////////////////////////////////////////////////////
return 0;}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  ll n;
  cin>>n;
  constexpr int MAX_N = 2e6;
  vector<ll> dp(MAX_N,INF);
  vector<ll> six(1),nine(1);
  ll s = 6;
  while(s<MAX_N){
    six.emplace_back(s);
    s *= 6;
  }
  ll q = 9;
  while(q<MAX_N){
    nine.emplace_back(q);
    q *= 9;
  }
  dp[0] = 0;
  for(int i=0;i<MAX_N;++i){
    chmin(dp[i+1],dp[i]+1);
    for(int j=1;j<six.size();++j)if(i+six[j]<MAX_N)chmin(dp[i+six[j]],dp[i]+1);
    for(int j=1;j<nine.size();++j)if(i+nine[j]<MAX_N)chmin(dp[i+nine[j]],dp[i]+1);
  }
  cout<<(dp[n])<<endl;

}

Measured memory_bytes: 15872