akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <set>
#include <map>

using namespace std;

#define MOD 1000000007
#define N_MAX 200002

typedef long long ll;

ll inv[N_MAX],fac[N_MAX],finv[N_MAX];

void init(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<N_MAX;i++){
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        fac[i]=fac[i-1]*(ll) i%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}

ll inv_(ll n){
    if(n == 1) return 1;
    else return MOD-inv_(MOD%n)*(MOD/n)%MOD;
}

ll comb(ll n, ll r){
  ll ans;
  if(n < 0 || r < 0){
      return 0;
  }
  if(n < r){
      ans = 0;
  }else{
      ans = (fac[n]*finv[r])%MOD;
      ans = (ans*finv[n-r])%MOD;
      ans = (ans+MOD)%MOD;
  }
  return ans;
}

typedef pair<int, int> P;

P p[3002];
ll dp[3002];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    init();
    int H, W, N;
    cin >> H >> W >> N;
    p[0] = P(0, 0);
    p[N+1] = P(H-1, W-1);
    for(int i = 0; i < N; i++){
        int r, c;
        cin >> r >> c;
        r--; c--;
        p[i+1] = P(r, c);
    }
    sort(p, p+N+2);
    dp[0] = 1;
    for(int i = 1; i <= N+1; i++){
        int r, c;
        r = p[i].first; c = p[i].second;
        dp[i] = comb(r+c, r);
       // cout << r << ' ' << c << endl;
       // cout << dp[i] << endl;
        for(int j = 1; j < i; j++){
            int s, t;
            s = p[j].first; t = p[j].second;
            dp[i] -= dp[j]*comb(r+c-s-t, r-s);
            dp[i] %= MOD;
            dp[i] += MOD;
            dp[i] %= MOD;
        }
    }
    cout << dp[N+1] << endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>
#include <sstream>
#include <bitset>
#include <stack>
#include <cstdlib>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

typedef long long ll;

using namespace std;

int main() {
    
    int n,c;
    cin >> n >> c;
    
    vector<vector<int>> d(c, vector<int>(c));
    
    FOR(i, 0, c){
        FOR(j, 0, c){
            cin >> d[i][j]; //色をiからjに変えるコスト
        }
    }
    
    vector<vector<int>> x(n, vector<int>(n)); // x：c
    vector<vector<int>> t(3, vector<int>(30,0)); // t[(i+j)%3][a]： あまりが(i+j)%3のときの色aの個数
    
    FOR(i, 0, n){
        FOR(j, 0, n){
            cin >> x[i][j];
            t[(i+j)%3][x[i][j]-1]++;
        }
    }
    
    int ans=1<<30; //int型でとりあえず大きい数字
    
    FOR(i, 0, c){
        FOR(j, 0, c){
            FOR(k, 0, c){
                if((i!=j)&&(j!=k)&&(k!=i)){
                    int tmp=0;
                    FOR(l, 0, c){
                        tmp += d[l][i]*t[0][l]; //あまり0のマス全てのの色をlからiに変えたときのコスト
                    }
                    FOR(l, 0, c){
                        tmp += d[l][j]*t[1][l]; //あまり1のマス全てのの色をlからjに変えたときのコスト
                    }
                    FOR(l, 0, c){
                        tmp += d[l][k]*t[2][l]; //あまり2のマス全てのの色をlからkに変えたときのコスト
                    }
                        
                    if(tmp<ans){
                        ans=tmp;
                    }
                }
            }
        }
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
const long long INF=1000000000;
typedef long long ll;
int main(){
    int n;
    double ans = 0;
    cin >> n;
    for (int i = 0; i < n;i++){
        double a;
        cin >> a;
        ans += 1 / a;
        //cout << ans << endl;
    }
    cout << 1 / ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;

int n, m;
ll cn[300000];
set<pair<int, int> > ss;

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; ++i)
		scanf("%lld", cn + i);
	for (int i = 0; i < m; ++i)
		scanf("%lld", cn + n + i);
	for (int i = 0; i < n + m; ++i)
		ss.insert(make_pair(cn[i], i));
	int x = n + 1;
	int y = m + 1;
	ll ans = 0;
	while (!ss.empty() && x && y) {
		ll cs = ss.begin()->first;
		int k = 0;
		if (ss.begin()->second >= n)
			k = 1;
		ss.erase(ss.begin());
		if (k == 0) {
			--x;
			ans += cs * y;
		}
		else {
			--y;
			ans += cs * x;
		}
	}
	cout << ans << "\n";
	return 0;
}




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

typedef long long ll;
const int N = 5010, mod = 1000000007;
int n, size[N], f[N][N], g[N], h[N];
vector<int> G[N];
void dfs(int x, int pre) {
  size[x] = 1;
  f[x][1] = 1;
  for (auto y : G[x]) if (y ^ pre) {
    dfs(y, x);
    for (int i = 1; i <= size[x]; i++) {
      for (int j = 0; j <= size[y]; j++) {
        h[i + j] = (h[i + j] + (ll) f[x][i] * f[y][j]) % mod;
      }
    }
    for (int i = 1; i <= size[x] + size[y]; i++) {
      f[x][i] = h[i];
      h[i] = 0;
    }
    size[x] += size[y];
  }
  for (int i = 2; i <= size[x]; i += 2) {
    f[x][0] = (f[x][0] + mod - (ll) f[x][i] * g[i] % mod) % mod;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1, x, y; i < n; i++) {
    scanf("%d%d", &x, &y);
    G[x].push_back(y);
    G[y].push_back(x);
  }
  g[0] = 1;
  for (int i = 2; i <= n; i += 2) {
    g[i] = (ll) g[i - 2] * (i - 1) % mod;
  }
  dfs(1, 0);
  int ans = (mod - f[1][0]) % mod;
  printf("%d\n", ans);
}


Measured memory_bytes: 97536
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var map = new int[n+1, n+1];
        for (int i = 0; i < n; i++)
        {
            var w = 0;
            string[] line = Console.ReadLine().Trim().Split(' ');
            for (int j = 0; j < n; j++)
            {
                map[i+1, j+1] = int.Parse(line[j]) + w;
                w = map[i+1, j+1];
            }
        }
        for (int i = 0; i < n; i++)
        {
            var w = 0;
            for (int j = 0; j < n; j++)
            {
                map[j+1, i+1] = map[j+1, i+1] + w;
                w = map[j+1, i+1];
            }
        }
        Console.WriteLine(n == 1 ? map[1,1]:getAns(map));
    }
    public static int getAns (int[,] map)
    {
        var n = map.GetLength(0);
        var ret = -999999999;
        for (int i = 1; i < n; i++)
            for (int j = i ; j < n; j++)
                for (int k = 1; k < n; k++)
                    for (int L = k; L < n; L++)
                    {
                        var w = map[j, L] - map[j, k-1] - map[i-1, L] + map[i-1, k-1];
                        ret = Math.Max(ret, w);
                    }
        return ret;
    }
}




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

int a,b,c,k,maks=0,temp=0;

int main(){
    cin>>a>>b>>c;
    cin>>k;
    maks=a;
    if(b>maks){
        maks=b;
    }
    if(c>maks){
        maks=c;
    }
    temp=maks;
    for(int i=1;i<=k;i++){
        maks=maks*2;
    }
    cout<<a+b+c-temp+maks<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>

#define For(i, j, k) for(int i = j; i <= k; i++)

const int N = 100010;

int A[N], m, n;

int main(){
	scanf("%d%d", &m, &n);
	int c = 0;
	For(i, 1, n) scanf("%d", &A[i]), c += A[i] & 1;
	if(c > 2){
		puts("Impossible");
		return 0;
	}
	if(n == 1){
		if(A[1] == 1) puts("1\n1\n1");
		else printf("%d\n2\n%d %d\n", A[1], A[1] - 1, 1);
		return 0;
	}
	For(i, 1, n)
		if(A[i] & 1) std::swap(A[i], A[c-- == 2 ? 1 : n]);
	For(i, 1, n) printf("%d%c", A[i], i == n ? '\n' : ' ');
	++A[1], --A[n];
	if(!A[n]) --n;
	printf("%d\n", n);
	For(i, 1, n) printf("%d%c", A[i], i == n ? '\n' : ' ');
	return 0;
}

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

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 998244353
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES puts("YES\n")
#define Yes puts("Yes\n")
#define NO  puts("NO\n")
#define No  puts("No\n")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }



signed main() {

	int a, b, h;
	cin >> a >> b >> h;
	
	cout << (a+b)*h/2 << endl;

	return 0;
}

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


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;cin>>n>>m;
    vector<string> a(n),b(m);
    rep(i,n)cin>>a[i];
    rep(i,m)cin>>b[i];
    rep(i,n-m+1){
        rep(j,n-m+1){
            bool flag = false;
            rep(k,m*m){
                int x=k%m,y=k/m;
                if(flag|=(a[i+x][j+y]!=b[x][y]))break;
            }
            if(!flag){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <map>
#include <iostream>
using namespace std;

int main() {
  int N,H;
  cin >> N >> H;
  vector<int> dmgh(N);
  vector<int> dmgt(N);
  for (int i=0; i<N; i++) {
    cin >> dmgh[i] >> dmgt[i];
  }
  int maxdmgh = 0;
  for (int i=0; i<N; i++) {
    maxdmgh = max(maxdmgh,dmgh[i]);
  }
  sort(dmgt.begin(),dmgt.end());
  reverse(dmgt.begin(),dmgt.end());
  int ans = 0;
  for (int i=0; i<N; i++) {
    if (dmgt[i] < maxdmgh) {
      break;
    }
    ans++;
    H -= dmgt[i];
    cerr << H << endl;
    if (H < 1) {
      cout << ans << endl;
      return 0;
    }
  }
  cout << ans + (H + maxdmgh - 1) / maxdmgh << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
 
const int INF = 100000000;
 
int main() {
	int a, b, c, d;
	int s, e;
 
	cin >> a >> b >> c >> d;
 
	s = max(a, c);
	e = min(b, d);
 
	if (e - s > 0)cout << e - s << endl;
	else cout << 0 << endl;
	return 0;
}

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

#define ll long long int

int main(){
	int k;
  	cin>>k;
  	vector<ll>a;
  	for(int i=1;i<=9;i++){
    	a.push_back(i);
    }
  	while(1){
    	if(k<=a.size()){
        	cout << a[k-1] << endl;
          	return 0;
        }
      	k-=a.size();
      	vector<ll>old;
      	swap(old,a);
      	for(ll x : old){
        	for(int i=-1;i<=1;i++){
             	int d=x%10+i;
              	if(d<0 || d>9){
                	continue;
                }
              	ll nx=x*10+d;
              	a.push_back(nx);
            }
        }
    }
  	return 0;
}


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

int main()
{
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='C')
		{
			for(int j=i+1;j<s.size();j++)
			{
				if(s[j]=='F')
				{
					cout<<"Yes";
					return 0;
				}
			}
		}
	}
	cout<<"No";

	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, m, i, count int64
	fmt.Scan(&n, &m)
	var h []int64 = make([]int64, n)
	var check []int64 = make([]int64, n)
	for i = 0; i < n; i++ {
		fmt.Scan(&h[i])
		check[i] = 1
	}

	var a, b []int64 = make([]int64, m), make([]int64, m)

	for i = 0; i < m; i++ {
		fmt.Scan(&a[i], &b[i])
	}

	for i = 0; i < m; i++ {
		if h[a[i]-1] > h[b[i]-1] {
			check[b[i]-1] = 0
		} else if h[b[i]-1] > h[a[i]-1] {
			check[a[i]-1] = 0
		} else if h[b[i]-1] == h[a[i]-1] {
			check[b[i]-1] = 0
			check[a[i]-1] = 0
		}
	}
	for i = 0; i < n; i++ {
		if check[i] == 1 {
			count++
		}
	}

	fmt.Println(count)
}


Measured memory_bytes: 8072
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <random>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)



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

	if (a > b) {
		swap(a, b);
	}

	if (a <= c && c <= b) {
		ANS("Yes")
	}
	else {
		ANS("No")
	}

	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        int max=0,tunnel=0,in=0,out=0;
        int time=0;
        boolean first=true;
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	if(first){
            		time=Integer.parseInt(line);
            		tunnel=Integer.parseInt(br.readLine());
            		max=tunnel;
            		first=false;
            	}else{
            		String[] str=line.split(" ");
            		in=Integer.parseInt(str[0]);
            		out=Integer.parseInt(str[1]);
            		if(in+tunnel-out<0){
            			System.out.println(0);
            			return;
            		}else{
            			tunnel=in+tunnel-out;
            			if(max<tunnel){
            				max=tunnel;
            			}
            		}
            	}
            	time--;
            	if(time<0){
            		break;
            	}
            }
            System.out.println(max);  
        }
    }

}

Measured memory_bytes: 31672
#include <iostream>
#include <string>

namespace ABC172
{
  class B
  {
  public:
    B() = default;
    ~B() = default;


    void Run()
    {
      std::string S = {};
      std::string T = {};
      std::cin >> S;
      std::cin >> T;

      int count = 0;
      for (int i = 0; i < S.size(); ++i)
      {
        if (S.at(i) != T.at(i)) count++;
      }


      std::cout << count << std::endl;
    }
  };

}
int main()
{

  ABC172::B prob;
  prob.Run();

  return 0;
}



Measured memory_bytes: 3440
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string.h>
using namespace std;
int dp[23][13][166];
int main()
{
    int n,k,s;
    memset(dp,0,sizeof dp);
    dp[0][0][0]=1;
    for(int j=0;j<=10;j++)
        for(int i=0;i<=20;i++)
            for(int s=155;s>=0;s--)
            if(dp[i][j][s])
                for(int e=i+1;e<=20&&s+e<=155;e++)
                dp[e][j+1][s+e]+=dp[i][j][s];
    for(int s=155;s>=0;s--)
    for(int j=0;j<=10;j++)
        for(int i=1;i<=20;i++)
            dp[i][j][s]+=dp[i-1][j][s];
    while(scanf("%d%d%d",&n,&k,&s)&&n)
    {
        printf("%d\n",dp[n][k][s]);
    }
    return 0;
}

Measured memory_bytes: 1388
n = int(input())
m = 10**9
cn = 0
s = 0
for x in input().split():
    y = int(x)
    z = abs(y)
    if y < 0:
        cn += 1
    s += z
    if m > z:
        m = z
if cn%2 == 0:
    print(s)
else:
    print(s - m*2)

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

int main(){
  string n;
  int k;
  cin>>n>>k;
  int ans=0;
  if(k==1){
    rep(i,n.size()){
      string s(n.size(),'0');
      rep(j,9){
	s[i]='0'+j+1;
	if(s<=n) ans++;
      }
    }
  }
  if(k==2){
    rep(i,n.size()){
      for(int j=i+1;j<n.size();j++){
	string s(n.size(),'0');
	rep(m,9){
	  s[i]='0'+m+1;
	  rep(o,9){
	    s[j]='0'+o+1;
	    if(s<=n) ans++;
	  }
	}
      }
    }
  }
  if(k==3){
    rep(i,n.size()){
      for(int j=i+1;j<n.size();j++){
	for(int l=j+1;l<n.size();l++){
	  string s(n.size(),'0');
	  rep(m,9){
	    s[i]='0'+m+1;
	    rep(o,9){
	      s[j]='0'+o+1;
	      rep(p,9){
		s[l]='0'+p+1;
		if(s<=n) ans++;
	      }
	    }
	  }
	}
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin() x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin() x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b; cin >> a >> b;

	ll ans=b;
	if (a < 13){
		ans = b/2;
		if (a <= 5) ans = 0;
	}

	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] input=new int[5];
        for(int i=0;i<5;i++){
            input[i]=sc.nextInt();
        }
        int minmod=10;
        int output=0;
        for(int i=0;i<5;i++){
            output+=input[i]%10==0?input[i]:input[i]-input[i]%10+10;
            if(input[i]%10<minmod&&(input[i]%10!=0)){
                minmod=input[i]%10;
            }
        }
        System.out.println(output-10+minmod);
    }
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int all = 0;
    vec<int> A(N);
    for(auto& x:A){
        cin >> x;
        all ^= x;
    }
    for(int i=0;i<N;i++) cout << (all^A[i]) << (i!=N-1? " ":"\n");
}

Measured memory_bytes: 3984
h,w=map(int,input().split())
s=[]
t=[(-1,1),(-1,0),(-1,-1),(0,1),(0,-1),(1,1),(1,0),(1,-1)]
for i in range(h):
    s.append(list(input()))
for i in range(h):
    for j in range(w):
        if s[i][j]==".":
            tmp=0
            for x,y in t:
                if 0<=i+x<=h-1 and 0<=j+y<=w-1:
                    if s[i+x][j+y]=="#":
                        tmp+=1
            s[i][j]=str(tmp)
for i in range(h):
    print("".join(s[i]))

Measured memory_bytes: 39792
N,M= map(int, input().split())
INF = float("inf")
key = []
for i in range(M):
    a, b = map(int, input().split())
    f = 0
    for c in list(map(int, input().split())):
        c -= 1
        f |= 1 << c
    key.append((f, a))
dp = [INF] * (1 << N) 
dp[0] = 0
 
for f in range(1 << N): 
    for i in range(M):
        t = f | key[i][0]
        cost = dp[f] + key[i][1]
        dp[t] = min(dp[t], cost)

ans = dp[-1]
if ans == INF:
    ans = -1
 
print(ans)

Measured memory_bytes: 46552
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define reps(i,x) for(ll i=1;i<=(ll)(x);i++)
#define rrep(i,x) for(ll i=((ll)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(ll)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
struct st{
	int a;
	int b;
	st(int ta, int tb){
		a = ta;
		b = tb;
	}
	bool operator<( const st& right ) const {
		return b < right.b;
	}
};
vector<st> sts;
int main() {
	int n, m;
	cin >> n >> m;
	int ta, tb;
	rep(i, m){
		cin >> ta >> tb;
		sts.push_back(st(ta,tb));
	}
	sort(all(sts));
	int ans = 0, pr = 0;
	rep(i, m){
		if(pr){
			if(pr < sts[i].a){
				ans++;
				pr = sts[i].b - 1;
			}
		}else{
			ans++;
			pr = sts[i].b - 1;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1400
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // int64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int(void) {
  int num;
  scanf("%d", &num);
  return num;
}

// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(int *arr, int size) {
    int i;
    for(i = 0; i < size; i++) {
        scanf("%d", &arr[i]);
    }
    return 0;
}

#define NUM_MAX 200000
#define VAL_MAX 1000000

int asc(const void *a1, const void *a2) {
    return *(int*)a1 - *(int*)a2;
}

int main(void) {
    int num = get_int();
    static int arr[NUM_MAX];
    fget_array(arr, num);
    qsort(arr, num, sizeof(int), asc);
    static char dp[VAL_MAX+1];
    memset(dp, 0x01, sizeof(char)*(VAL_MAX+1));
    int i, j;
    int prev = 0;
    // sieve of eratosthenes
    for(i = 0; i < num; i++) {
        int val = arr[i];
        if(!dp[val]) continue;
        // important!!
        if(val == prev) {
            dp[val] = 0;
            continue;
        }
        prev = val;
        int ulimit = VAL_MAX/val;
        for(j = 2; j <= ulimit; j++) {
            dp[val*j] = 0;
        }
    }
    int cnt = 0;
    for(i = 0; i < num; i++) {
        cnt += dp[arr[i]];
    }
    printf("%d\n", cnt);
    return 0;
}

Measured memory_bytes: 3456
n = int(input())
a = list(map(int, input().split()))

cnt = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if a[i] != a[j] and a[i] != a[k] and a[j] != a[k]:
                if i < j < k:
                    if a[i] + a[j] > a[k] and a[j] + a[k] > a[i] and a[k] + a[i] > a[j]:
                        cnt += 1
print(cnt)

Measured memory_bytes: 9204
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 998244353
#define fi first
#define se second
#define pii pair<int,int>
#define int long long
#define endl '\n'
#define pll pair<long long,long long>
#define LONGLONG_MAX 100000000000000
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}
string s[100005];
map<string,int>m;
string ans;
map<string,int>m1;
bool fun(int i,vector<int>v,int n){
    if(v[0]<0||v[1]<0||v[2]<0)return false;
    if(i==n){
        return true;
    }
    v[s[i][0]-'A']++;
    v[s[i][1]-'A']--;
    if(fun(i+1,v,n)){
        ans.push_back(s[i][0]);
        return true;
    }
    v[s[i][0]-'A']--;
    v[s[i][1]-'A']++;
    
    v[s[i][0]-'A']--;
    v[s[i][1]-'A']++;
    if(fun(i+1,v,n)){
        ans.push_back(s[i][1]);
        return true;
    }
    return false;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,a,b,c;
    cin>>n>>a>>b>>c;
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    m1["AB"]=0;
    m1["BC"]=1;
    m1["AC"]=2;
    vector<int>v;
    v.push_back(a);
    v.push_back(b);
    v.push_back(c);
    if(fun(0,v,n)){cout<<"Yes"<<endl;reverse(ans.begin(),ans.end());for(auto j:ans)cout<<j<<endl;return 0;}
    cout<<"No";
    return 0;
}


Measured memory_bytes: 23976
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <list>
#include <numeric>
using namespace std;

long long combi(long long n, long long k) {
  if (n == k || k == 0)
    return 1;
  else {
    return combi(n - 1, k - 1) + combi(n - 1, k);
  }
}

int main(){    
  string S;
  cin >>  S;
  for(int i=0;i<S.length();i++){
    if(S[i] == '7'){
    cout << "Yes" << endl;
    return 0;
    }
  }
  cout << "No" <<endl;
}


Measured memory_bytes: 3592
n = int(input())
zen = int(n // 100)
go = int(n % 100)
if zen and zen <= 12 and go and go <= 12:
  print("AMBIGUOUS")
elif zen and zen <= 12:
  print("MMYY")
elif go and go <= 12:
  print("YYMM")
else:
  print("NA")

Measured memory_bytes: 3060
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<random>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include <queue>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney, tree, chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun

#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIY PRI("Yes")
#define PRIN PRI("No")
#define MINS(a,b) a = min(a,(decltype(a))(b))
#define MAXS(a,b) a = max(a,(decltype(a))(b))

//N/? > N/xとなる最大の?
ll bins(ll N, ll x) {
	ll l = 0;
	ll r = 1e10;
	while (l + 1 < r) {
		ll mid = l + (r - l) / 2;
		if (N / x < N / mid)l = mid;
		else r = mid;
	}
	return l;
}

int main() {
	ll N, K;
	cin >> N >> K;
	if (N == 1) {
		PRI(1);
		return 0;
	}
	vector<ll> v,c;
	v.push_back(N);
	while (v.back() > 1) v.push_back(bins(N, v.back()));
	v.push_back(0);
	//N/v[*]=N/?=aである?の個数
	for (int i = 0; i < v.size() - 1; ++i) c.push_back(v[i] - v[i + 1]);
	v.pop_back();
	reverse(v.begin(), v.end());
	reverse(c.begin(), c.end());
	vector<vector<ll>> tbl(K + 1);
	ll mod = 1e9 + 7;
	REP(i, 0, K + 1) {
		tbl[i].resize(v.size() + 1, 0);
	}
	REP(i, 0, v.size()) {
		tbl[1][i + 1] = (tbl[1][i] + c[i]) % mod;
	}
	REP(i, 2, K + 1) {
		REP(j, 0, v.size()) {
			tbl[i][j + 1] = (tbl[i][j] + tbl[i - 1][distance(v.begin(), upper_bound(v.begin(), v.end(), N / v[j]))] * c[j]) % mod;
		} 
	}
	PRI(tbl[K][v.size()]);
	return 0;
}




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

int main(){
  ll n,sum=0;
  cin >> n;
  unordered_map<string, ll> mp;
  for(ll i=0;i<n;i++){
    string s;
    cin >> s;
    sort(s.begin(),s.end());
    if(mp.find(s) == mp.end()){
      mp[s] = 1;
    }
    else{
      mp[s] +=1;
    }
  }
  for (auto x :mp) {
    sum += (x.second * (x.second - 1))/2;
  }
  cout << sum << endl;
}

Measured memory_bytes: 10660
//二分搜索
#include<stdio.h>

int A[100000], n;

int binarySearch(int key)
{
	int left = 0;
	int right = n;
	int mid;
	while (left < right)
	{
		mid = (left + right) / 2;
		if (key == A[mid]) return 1;//find key
		else if (key > A[mid]) left = mid + 1;//搜索后半部分
		else if (key < A[mid]) right = mid;//搜素后半截
	}
	return 0;//循环推出，未找到
}
int main()
{
	int i, q, key, sum = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++) scanf("%d", &A[i]);
	scanf("%d", &q);
	for (i = 0; i < q; i++)
	{
		scanf("%d", &key);
		if (binarySearch(key)) sum++;
	}
	printf("%d\n", sum);
	return 0;
}


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


int main(){
    ll x; cin >> x;
    for(ll i=-220;i<=220;i++){
        for(ll j=-220;j<=220;j++){
            if(i*i*i*i*i-j*j*j*j*j==x){
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
}



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

using namespace std;

int main()
{
	int n, t, a;
	cin >> n >> t >> a;
	int idx = -1;
	double min_delta = INT_MAX;

	vector<double> h(n);
	for (int i = 0; i < n; i++)
	{
		cin >> h.at(i);
		double temperature = t - h.at(i) * 0.006;
		double delta = abs(temperature - a);
		if (delta < min_delta)
		{
			min_delta = delta;
			idx = i + 1;
		}
	}

	cout << idx << endl;
}


Measured memory_bytes: 256
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static void solve() throws Exception {
		int n = scanInt();
		int a[] = new int[n];
		int md[] = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = scanInt();
			if (a[i] > (i == 0 ? 0 : a[i - 1] + 1)) {
				out.print(-1);
				return;
			}
			md[i - a[i]] = a[i];
		}
		long ans = 0;
		for (int i = 0; i < n; i++) {
			ans += md[i];
		}
		out.print(ans);
	}

	static int scanInt() throws IOException {
		return parseInt(scanString());
	}

	static long scanLong() throws IOException {
		return parseLong(scanString());
	}

	static String scanString() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

Measured memory_bytes: 43444
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

       




        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);


            var n = Read();
            var dx = Reads();
            var d = dx[0];
            var x = dx[1];
            var a = new long[n];
            long ans = 0;
            for (int i = 0; i < n; i++)
            {
                a[i] = Read();
                ans += (d - 1) / a[i]+1;
            }

            Console.WriteLine(ans+x);






            Console.Out.Flush();
        }
    }
}




Measured memory_bytes: 13268
import collections

num_of_papers = int(input())
names = []

for _ in range(num_of_papers):
    names.append(input())

cnt = collections.defaultdict(int)
max_appearance = 0
for _ in names:
    cnt[_] = cnt[_] + 1

    if max_appearance < cnt[_]:
        max_appearance = cnt[_]

max_names = [key for key, value in cnt.items() if value == max_appearance]

max_names.sort()

for _ in max_names:
    print(_)
    

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

typedef long long ll;
#define rep(i, s, n) for(int i=s;i<n;i++)
#define repeq(i,s,n) for(int i=s;i<=n;i++)
#define MOD 10e9+7

void max_self(int& a, int b) { a=a>b?a:b; }
void min_self(int& a, int b) { a=a<b?a:b; }

using namespace std;

int n;
string s;
string temp = "ABC";
string curr;
int cnt;

int main() {

    cin >> n;
    cin >> s;

    for(int i = 0; i < n-2; i++) {
        curr.assign(s, i, 3);
        if(curr==temp)
            cnt++;
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int x,y,z=0,a;
cin >>x >>y;
for(int i=0;i<x;i++)cin>>a;
x-=y;
z++;
if(x%(y-1)!=0){z++;x-=x%(y-1);}
z+=x/(y-1);
cout << z << endl;
return 0;
}


Measured memory_bytes: 256
open System

[<EntryPoint>]
let main argv =
    let NR = Console.ReadLine().Split() |> Array.map (fun x -> int x)
    let ans = if NR.[0] < 10 then NR.[1] + 100 * (10 - NR.[0]) else NR.[1]
    printfn "%d" ans
    0


Measured memory_bytes: 14032
#B問題
N=int(input())
H=list(map(int,input().split()))
count=0
hot=[]
for i in range(N):
    if i == 0:
        count+=1
        hot.append(H[0])
    else:
        if max(hot) <= H[i]:
            count+=1
        hot.append(H[i])
print(count)

Measured memory_bytes: 3060
import java.util.*;

public class Main {

	public static int s(int n) {
		String sn = String.valueOf(n);
		int ans = 0;
		for (int i = 0; i < sn.length(); ++i) {
			int tmp = (int) (sn.charAt(i) - '0');
			ans += tmp;
		}

		return ans;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		String ans[] = {"Yes", "No"};
		int an = 0;
		int tmpans = s(n);
		if(n % tmpans != 0)an = 1;
		System.out.println(ans[an]);
	}

}


Measured memory_bytes: 22740
#include<iostream>
#include<cstdio>
#include<map>
#include<vector>
#include<queue>
using namespace std;

#define MP make_pair
#define PB push_back

int main(int argc,char* argv[]){
  multimap<int,vector<int> > tab;
  vector<int> vec;
  int a,b,c,x,i,j,count,n;
  int flag[400];

  while(cin>>a>>b>>c){
    if(a==0 && b==0 && c==0) break;
    for(i=0;i<400;i++) flag[i]=2;
    tab.clear();
    
    cin>>n;
    for(i=0;i<n;i++){
      vec.clear();
      for(j=0;j<3;j++){
	cin>>x;
	vec.PB(x);
      }
      cin>>x;
      if(x==1) tab.insert(MP(0,vec));
      else tab.insert(MP(1,vec));
    }

    multimap<int,vector<int> >::iterator itr;
    for(itr=tab.begin();itr!=tab.end();itr++){
      if((*itr).first==0){
	vector<int>::iterator it;
	for(it=(*itr).second.begin();it!=(*itr).second.end();it++){
	  flag[(*it)]=1;
	}
      }
      else{
	vec.clear();
	count=0;
	vector<int>::iterator it;
	for(it=(*itr).second.begin();it!=(*itr).second.end();it++){
	  if(flag[(*it)]==1) count++;
	  else{
	    vec.PB((*it));
	  }
	}
	if(count==2){
	  flag[vec.back()]=0;
	}
      }
    }
    for(i=1;i<=a+b+c;i++){
      cout<<flag[i]<<endl;
    }
  }
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  int h[n];
  int i;
  for (i = 0; i < n; i++) {
    cin >> h[i];
  }
  int max_h = 0;
  int result = 0;
  for (i = 0; i < n; i++) {
    if (max_h <= h[i]) {
      result ++;
    }
    max_h = max(max_h, h[i]);

  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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();
    int sum1 = a+b;
    int sum2 = a+c;
    int sum3 = b+c;
    if(sum1<=sum2&&sum1<=sum3){
      System.out.println(sum1);
    }else if(sum2<=sum1&&sum2<=sum3){
      System.out.println(sum2);
    }else{
      System.out.println(sum3);
    }
  }
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;

bool isPrime(int num) {
  if (num < 2) return false;
  if (num == 2) return true;
  if (num % 2 == 0) return false;

  for (int i = 3; i < sqrt(num); i += 2) {
    if (num % i == 0) {
      return false;
    }
  }
  return true;
}

int main() {
  int x;
  cin >> x;
  for (int i = x; i < 100004; i++) {
    if (isPrime(i)) {
      cout << i;
      return 0;
    }
  }
}

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

void fnInput(vector<vector<int>>& rvvnEnjoy)
{
  int nEnjoySiz;
  cin >> nEnjoySiz;
  rvvnEnjoy.resize(nEnjoySiz, vector<int>(3));

  for (int i = 0; i < nEnjoySiz; i++)
    cin >> rvvnEnjoy[i][0] >> rvvnEnjoy[i][1] >> rvvnEnjoy[i][2];
}
  
int fnDPHappy(const vector<vector<int>>& cnrvvnEnjoy)
{
  vector<vector<int>> vvnDPHappy(cnrvvnEnjoy.size() + 1, vector<int>(cnrvvnEnjoy[0].size()));

  for (int i = 0; i < vvnDPHappy.size() - 1; i++)
    for (int j = 0; j < vvnDPHappy[i].size(); j++)
      for (int k = 0; k < vvnDPHappy[i].size(); k++)
        if (j != k)
          vvnDPHappy[i + 1][j] = max(vvnDPHappy[i + 1][j], vvnDPHappy[i][k] + cnrvvnEnjoy[i][j]);

  int nMaxHappy = 0;
  int nLastDay = vvnDPHappy.size() - 1;

  for (int j = 0; j < vvnDPHappy[nLastDay].size(); j++)
    nMaxHappy = max(nMaxHappy, vvnDPHappy[nLastDay][j]);

  return nMaxHappy;
}
  
int main()
{
  vector<vector<int>> vvnEnjoy;
  fnInput(vvnEnjoy);
  cout << fnDPHappy(vvnEnjoy) << endl;

  return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x=0,y=0,A,B,C;
  cin>>A>>B>>C;
    while(x<C){
      y=y+1;
      if(y%7==0){
	x=x+B;
	x=x+A;}
	else {
	  x=x+A;}

    }
    cout<<y<<endl;
    return 0;
}



    
      



Measured memory_bytes: 3100
#include<stdio.h>
#include<stdlib.h>
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int i,j,n,C[VMAX+1],k;
  k=VMAX;
  scanf("%d" ,&n);
  A=malloc(sizeof(short) * n+1);
  B=malloc(sizeof(short) * n+1);
  for(i=0 ; i <=k ; i++) C[i]=0;
  for(i=0 ; i<n ; i++){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  for(i=1 ; i <=k ; i++) C[i] = C[i] + C[i-1];

  for(j=1 ; j <=n ; j++) {
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
  for(i=1 ; i<=n ; i++){
    if(i>1) printf(" ");
    printf("%d" ,B[i]);
  }
  printf("\n");
  return 0;
}





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

int main () {
  int N,M;
  cin >> N;
  M=N%10;
  if (M==2||M==4||M==5||M==7||M==9) {
    cout << "hon" << endl;
  }
  if (M==0||M==1||M==6||M==8) {
    cout << "pon" << endl;
  }
  if (M==3) {
    cout << "bon" << endl;
  }
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
const long long INF=1e13;
struct edge{int from,to,cost;};
edge es[2000];
long long d[1000];
int V,E;
void shortest_path(int s){
	for(int i=0;i<V;i++)
		d[i]=INF;
	d[s]=0;
	for(int i=0;i<V;i++){
		for(int j=0;j<E;j++){
			edge e=es[j];
			if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost)
				d[e.to]=d[e.from]+e.cost;
		}
	}
}
bool find_negative_loop(){
	memset(d,0,sizeof(d));
	for(int i=0;i<2*V;i++){
		for(int j=0;j<E;j++){
			edge e=es[j];
			if(d[e.to]>d[e.from]+e.cost){
				d[e.to]=d[e.from]+e.cost;
				if(i>=V-1&&e.to==V-1)
					return true;
			}
		}
	}
	return false;
}
int main(){
	cin>>V>>E;
	int a,b,c;
	for(int i=0;i<E;i++){
		cin>>a>>b>>c;
		es[i]=(edge){a-1,b-1,-c};
	}
	if(find_negative_loop()){
		cout<<"inf"<<endl;
		return 0;
	}
	shortest_path(0);
	cout<<-d[V-1]<<endl;
}


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

int main(){
int A,B;
  cin>>A>>B;
  if(A==B){
cout<<"Draw"<<endl;
  }
  else if(A==1){
cout<<"Alice"<<endl;
  }
  else if(B==1){
cout<<"Bob"<<endl;
  }
  else if(A>B){
cout<<"Alice"<<endl;
  }
  else{
cout<<"Bob"<<endl;
  }
}
  

Measured memory_bytes: 256
//Ruined Square

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a / __gcd(a, b) * b
#define range(a) (a).begin(),(a).end()
const int inf = 2147483647;

int main (){
    int x,y,xx,yy;cin>>x>>y>>xx>>yy;
    int Dx = xx-x,Dy = yy-y;
    cout << xx-Dy <<" "<< yy+Dx <<" "<< x-Dy <<" "<< y+Dx << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int H, N;
  cin>>H>>N;
  int sum = 0, a;
  for(int i=0; i<N; i++){
    cin>>a;
    sum+=a;
  }
  cout<<(H<=sum? "Yes\n": "No\n");
}

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

int main(){
	int K;
	
		cin>>K;

		for(int I=0;I<K;I++)
		{
			string str;
			cin>>str;
			int n[1002]={};
			int s=0,c=0;
			for(int i=0;i<str.size();i++)
			{if(s%10+str[i]-'0'>9)c++;s+=str[i]-'0';s=s%10+s/10;}
			int rot=c+str.size()-1;
			
			if(rot%2==1)cout<<"Fabre wins."<<endl;
			else cout<<"Audrey wins."<<endl;
		}
		return 0;
}
			

Measured memory_bytes: 1200
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <fstream>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
long long bases[1000000] = {};
int used[1000000] = {};
int users[1000000] = {};
int main() {
#define int long long
	iostream::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<long long> a;
	REP(i, 3*n) {
		long long hoge;
		cin >> hoge;
		a.push_back(hoge);
	}
	vector<pair<long long,long long>> nya;
	for (int i = n;i < 3 * n;++i) {
		nya.push_back(make_pair(a[i], i));
	}
	sort(nya.begin(), nya.end());
	int cnt = n;
	for (int i = 0;i < n;++i) {
		bases[n] += nya[i].first;
	}
	for (int i = n;i < 2 * n;++i) {
		//determine where is there
		long long bot = 0;
		long long top = 2 * n - 1;
		while (top - bot > 1) {
			long long mid = (top + bot) / 2;
			if (nya[mid].first > a[i]||(nya[mid].first == a[i]&&used[mid] == false)) {
				top = mid;
			}
			else {
				bot = mid;
			}
		}
		long long whereis = 0;
		if (nya[bot].first == a[i] && used[bot] == false) {
			whereis = bot;
		}
		else {
			whereis = top;
		}
		used[whereis] = true;
		if (whereis < cnt) {
			cnt++;
			while (used[cnt-1] == true) {
				cnt++;
			}
			bases[i + 1] = bases[i] - nya[whereis].first + nya[cnt-1].first;
		}
		else {
			bases[i + 1] = bases[i];
		}
	}
	vector<long long> as;
	for (int i = 0;i < 2 * n;++i) {
		as.push_back(a[i]);
	}
	cnt = n;
	long long answer = -LONG_INF;
	sort(as.begin(), as.end(), greater<long long>());
	long long now = 0;
	for (int i = 0;i < n;++i) {
		now += as[i];
	}
	answer = now - bases[2*n];
	for (int i = 2*n-1;i >= n;--i) {
		//determine where is there
		long long bot = 0;
		long long top = 2 * n;
		while (top - bot > 1) {
			long long mid = (top + bot) / 2;
			if (as[mid] < a[i] || (as[mid] == a[i] && users[mid] == false)) {
				top = mid;
			}
			else {
				bot = mid;
			}
		}
		long long whereis = 0;
		if (as[bot] == a[i] && users[bot] == false) {
			whereis = bot;
		}
		else {
			whereis = top;
		}
		users[whereis] = true;
		if (whereis < cnt) {
			cnt++;
			while (users[cnt-1] == true) {
				cnt++;
			}
			now += as[cnt-1];
			now -= as[whereis];
		}
		answer = max(answer, now - bases[i]);
	}
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 18284
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	private char max(char[] a) {
		char result = a[0];
		for(int i=1;i<a.length;i++) {
			result = result < a[i] ? a[i] : result;
		}
		return result;
	}
	private char min(char[] a) {
		char result = a[0];
		for(int i=1;i<a.length;i++) {
			result = result > a[i] ? a[i] : result;
		}
		return result;
	}
	
	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		String s = sc.next();
		String t = sc.next();
		sc.close();

		List<Character> cs = new ArrayList<>();
		List<Character> ct = new ArrayList<>();
		
		for(int i=0;i<s.length();i++) {
			cs.add(s.charAt(i));
		}
		for(int i=0;i<t.length();i++) {
			ct.add(t.charAt(i));
		}
		
		cs.sort(Comparator.naturalOrder());
		ct.sort(Comparator.reverseOrder());
		
		if(cs.size() >= ct.size()) {
			for(int i=0;i<ct.size();i++) {
				if(cs.get(i) == ct.get(i)) {
					continue;
				}
				if(cs.get(i) < ct.get(i)) {
					out.println("Yes");
					return;
				}else {
					out.println("No");
					return;
				}
			}
			out.println("No");
		}else if(cs.size() < ct.size()) {
			for(int i=0;i<cs.size();i++) {
				if(cs.get(i) == ct.get(i)) {
					continue;
				}
				if(cs.get(i) < ct.get(i)) {
					out.println("Yes");
					return;
				}else {
					out.println("No");
					return;
				}
			}
			out.println("Yes");
		}
		
	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

}


Measured memory_bytes: 23124
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
//---------------------------------//
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
//------------------------------//

typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;

#define  ff           first
#define  ss           second
#define  pb           push_back
#define  IOS          ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define  all(x)       (x).begin(), (x).end()
#define  ps(x,y)      fixed<<setprecision(y)<<x
#define  rep(i,a,b)   for(ll i=a ; i<b ; ++i)

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const ll maxn = 1e6 + 4;


void solve(){
  string s;
  cin >> s;
  int n = s.size();
  if(s[n-1]=='s')cout << s << "es";
  else cout << s<<"s";
}  

int main(){
  IOS
  	solve();
  //cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
}

// integer overflow

Measured memory_bytes: 3648
#include<iostream>
#include<cmath>
using namespace std;
int main(){
  long long N, D, X, Y, cnt=0;
  cin >> N >> D;
  for(int i=0; i<N; i++){
    cin >> X >> Y;
    if(sqrt(X*X+Y*Y) <= D) cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3704
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

int main() {
  int n, d, x;
  scanf("%d%d%d", &n, &d, &x);
  long double dx = x, s = d, ans = 0;
  for (int i = 2 * n; i; i -= 2) {
    ans += (i - 1) * dx / 2 + s;
    s = (s * 2 + dx * 5 + i * s) / i;
    dx = dx * (4 + i) / i;
  }
  printf("%.10Lf\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <utility>
#include <queue>
#include <vector>

#define FOR(i, n) for(int i = 0; i < n; i++) 

#define pow CHANGETHENAMESTUPID

using namespace std;

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

const int MAXN = 200;

int dist[MAXN][MAXN];
bool wrong = false;
int n;

void load() {
	scanf("%d", &n);
	FOR(i, n) {
		char s[n+1]; scanf("%s", s);
		FOR(j, n) dist[i][j] = s[j] == '1' ? 1 : 0;
	}
}

void bfs(int x) {
	vector<bool> bio(n);
	queue<int> Q;
	Q.push(x); Q.push(-1);
	while (!Q.empty()) {
		int cur = Q.front(); Q.pop();
		int par = Q.front(); Q.pop();
		if (bio[cur]) continue;
		if (cur != x) {
			dist[x][cur] = dist[x][par] + 1;
		}
		bio[cur] = true;
		FOR(i, n) {
			if (i == par) continue;
			if (dist[cur][i] == 1) {
				if (bio[i] && (dist[x][cur] + dist[x][i]) % 2 == 0) wrong = true;
				if (!bio[i]) {
					Q.push(i); Q.push(cur);
				}
			}
		}
	}
}

int solve() {
	FOR(i, n) bfs(i);
	//FOR(i, n) { FOR(j, n) printf("%d ", dist[i][j]); printf("\n"); }
	if (wrong) return -1;
	int maxi  = 0;
	FOR(i, n) FOR(j, n) maxi = max(maxi, dist[i][j]);
	return maxi + 1;
}

int main() {
	load();
	printf("%d\n", solve());
	return 0;
}


Measured memory_bytes: 608
#include <bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
int a[maxn*4];
int vis[maxn*4];
int b[maxn*4];
int main()
{
    string s;
    int x;
    cin>>s>>x;
    for(int i=0;i<s.length();i+=x){
        cout<<s[i];
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256