akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int T = in.nextInt();
		int A = in.nextInt();
		int[] H  = new int[N];
		for (int i = 0; i < N; i++) {
			H[i] = in.nextInt();
		}
		double[] aveT = new double[N];
		for (int i = 0; i < N; i++) {
			aveT[i] = T - H[i] * 0.006;
		}
		int min = 0;
		for (int i = 1; i < N; i++) {
			if (Math.abs(aveT[i]-A) < Math.abs(aveT[min]-A)) {
				min = i;
			}
		}
		System.out.println(min+1);
	}

}


Measured memory_bytes: 23892
// https://qiita.com/e869120/items/eb50fdaece12be418faa
// https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_d
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (a); i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
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; }
typedef long long ll;

int main()
{
    int N;
    string S;
    cin >> N >> S;

    ll res = 0;
    for (int i = 0; i < 1000; i++) {
        std::ostringstream ss;
	    ss << std::setw(3) << std::setfill('0') << i;
        string s(ss.str());

        int k = 0;
        for (int j = 0; j < N; j++) {
            if (S[j] == s[k]) {
                k++;
            }
            if (k == 3) {
                res++;
                break;
            }
        }
    }

    cout << res << endl;

    return 0;
}

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

map<int, map<int, int> > dp1;
map<int, map<int, int> > dp2;
int mo=1000000007;
int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    int x[n+5];
    int y[m+5];
    int dpx[n+5];
    int dpy[m+5];
    for(int i=0;i<n;i++)
        cin>>x[i];
    for(int j=0;j<m;j++)
        cin>>y[j];
    sort(x,x+n);
    int mo=1000000007;
    int sx=0,sy=0;
    for(int i=1;i<n;i++)
        sx=(sx + (((((x[i]-x[i-1])*i)%mo)*(n-i))%mo) )%mo;
    sort(y,y+m);
    for(int i=1;i<m;i++)
        sy=(sy + (((((y[i]-y[i-1])*i)%mo)*(m-i))%mo) )%mo;

    //cout<<sx<<" "<<sy<<" ";
    cout<<(sx*sy)%mo;
}

Measured memory_bytes: 5160
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CDubiousDocument solver = new CDubiousDocument();
        solver.solve(1, in, out);
        out.close();
    }

    static class CDubiousDocument {
        static final char a = 'a';
        static final char z = 'z';

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();

            int[] count = new int[z + 1];
            for (int i = a; i <= z; i++)
                count[i] = Integer.MAX_VALUE;

            for (int i = 0; i < n; i++) {
                String s = in.next();
                for (int c = a; c <= z; c++) {
                    int tot = 0;
                    for (int j = 0; j < s.length(); j++) {
                        if (s.charAt(j) == c) {
                            tot++;
                        }
                    }
                    count[c] = Math.min(count[c], tot);
                }
            }

            StringBuilder sb = new StringBuilder();
            for (char c = a; c <= z; c++) {
                for (int i = 0; i < count[c]; i++) {
                    sb.append(c);
                }
            }

            out.println(sb.toString());
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

using namespace std;

int main(void)
{
    unsigned int k;

    cin >> k;

    int ans = 0;
    int remainder = 0;
    for (int i = 0; i < k; i++)
    {
        ans++;
        remainder = (remainder * 10 + 7) % k;
        if (remainder == 0)
            break;
        if (i == k - 1)
            ans = -1;
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 3592
import java.util.Scanner;


class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        
        int x = stdIn.nextInt();
        int y = stdIn.nextInt();
        
        if (x == 2)
            System.out.println("No");
        else if (x == 4 || x == 6 || x == 9 || x == 11)
            if (y == 4 || y == 6 || y == 9 || y == 11)
                System.out.println("Yes");
            else
                System.out.println("No");
        else if (x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10 || x == 12)
            if (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12)
                System.out.println("Yes");
            else 
                System.out.println("No");        
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int x,y,z,tmp;
	cin>>x>>y>>z;
	tmp=x;
	x=y;
	y=tmp;
	
	tmp=z;
	z=x;
	x=tmp;
	cout<<x<<' '<<y<<' '<<z;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

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

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

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

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main(){
    char s[11];
    char str[4];
    scanf("%s",&s);
    char *p;
    int min = 999999;
    for(p=s;*(p+2)!='\0';p++){
        for(int i=0;i<3;i++) str[i] = *(p+i);
        int num =atoi(str);
        if(min > abs(num-753)) min = abs(num-753);
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define NMAX 10
#define FMAX 3628800
#define min(a, b) ((a) < (b) ? (a) : (b))

int hash(int *a, int asize);
void rev_sort(int l, int r, int *a, int asize);
void bfs(int *a, int asize, char *memo, int depth, int maxdepth);
int main (void)
{
  int i, n, maxdepth, fact = 1, res = 9, a[NMAX], b[NMAX];
  char memo1[FMAX], memo2[FMAX];
  scanf("%d", &n);
  maxdepth = (n - 1) / 2;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    fact *= i + 1;
    b[i] = i + 1;
  }
  for (i = 0; i < fact; i++) memo1[i] = memo2[i] = n;
  memo1[hash(a, n)] = memo2[hash(b, n)] = 0;
  bfs(a, n, memo1, 0, maxdepth);
  bfs(b, n, memo2, 0, maxdepth);
  for (i = 0; i < fact; i++) res = min(res, memo1[i] + memo2[i]);
  printf("%d\n", res);
}

int hash(int *a, int asize)
{
  int i, j, res = 0, fact = 1;
  for (i = 0; i < asize; i++) {
    int grade = 0;
    for (j = i + 1; j < asize; j++) if (a[i] < a[j]) grade++;
    res += grade * fact;
    fact *= asize - i;
  }
  return res;
}

void rev_sort(int l, int r, int *a, int asize)
{
  int i;
  for (i = 0; i < asize; i++) {
    int temp;
    if (l + i >= r - i) break;
    temp = a[l+i];
    a[l+i] = a[r-i];
    a[r-i] = temp;
  }
}

void bfs(int *a, int asize, char *memo, int depth, int maxdepth)
{
  int i, j;
  if (depth >= maxdepth) return;
  for (i = 0; i < asize; i++) {
    for (j = i + 1; j < asize; j++) {
      int h;
      rev_sort(i, j, a, asize);
      h = hash(a, asize);
      if (memo[h] > depth + 1) {
        memo[h] = depth + 1;
        bfs(a, asize, memo, depth + 1, maxdepth);
      }
      rev_sort(i, j, a, asize);
    }
  }
}


Measured memory_bytes: 8932
#include<iostream>
using namespace std;
typedef pair<int, int> pii;
pii dxdy[]={{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
char fld[20][20];
bool used[20][20];
int W, H;

void rec(int i, int j){
   used[i][j]=1;
   for(pii dd: dxdy){
      int ni=i+dd.first;
      int nj=j+dd.second;
      if(!(0<=ni&&ni<H&&0<=nj&&nj<W)) continue;
      if(used[ni][nj]) continue;
      if(fld[ni][nj]!='.') continue;
      rec(ni, nj);
   }
}

int main(){

   while(1){
      cin>> W>> H;
      if(!(H||W)) break;
      int sx, sy;
      for(int i=0; i<H; i++){
         for(int j=0; j<W; j++){
            cin>> fld[i][j];
            if(fld[i][j]=='@'){
               sy=i;
               sx=j;
            }
         }
      }

      for(int i=0; i<20; i++)for(int j=0; j<20; j++) used[i][j]=0;
      used[sy][sx]=1;
      rec(sy, sx);
      int ans=0;
      for(int i=0; i<H; i++)for(int j=0; j<W; j++){
         ans+=used[i][j];
      }
      cout<< ans<< endl;

   }

   return 0;
}

Measured memory_bytes: 3048
import java.util.*;

class Main{
	public static void main(String[] Args){
		Scanner sc = new Scanner(System.in);
		int q = sc.nextInt();
		ArrayList<Integer> A = new ArrayList<Integer>();
		for(int i = 0; i < q; i++){
			int op = sc.nextInt();
			if(op == 0){
				int x = sc.nextInt();
				A.add(x);
			}else if(op == 1){
				int p = sc.nextInt();
				System.out.println(A.get(p));
			}else A.remove(A.size() - 1);
		}
	}
};



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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> broken(n+1);
  rep(i,m) {
    int a;
    cin >> a;
    broken[a] = 1;
  }
  vector<int> dp(n+2);
  const int mod = 1000000007;
  dp[n] = 1;
  for (int i = n-1; i >= 0; i--) {
    if (broken[i]) {
      dp[i] = 0;
      continue;
    }
    dp[i] = (dp[i+1] + dp[i+2]) % mod;
  }
  cout << dp[0] << endl;
  return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    long long mod = 998244353;
    int N, K;
    cin >> N >> K;
    vector<int> L(K), R(K);
    for (int i = 0; i < K; ++i) {
        cin >> L[i] >> R[i];
    }
    vector<long long> way(N, 0), sum(K, 0);
    way[0] = 1;
    for (int i = 1; i < N; ++i) {
        for (int j = 0; j < K; ++j) {
            if (i > R[j]) {
                // i - 1 : (i - 1 - R[j]) ~ (i - 1 - L[j]) -> i : (i - R[j]) ~ (i - L[j])
                // - way[i - 1 - R[j]], + way[i - L[j]]
                sum[j] = (sum[j] - way[i - 1 - R[j]] + mod) % mod;
                sum[j] = (sum[j] + way[i - L[j]]) % mod;
                way[i] = (way[i] + sum[j]) % mod;
            } else if (L[j] <= i) {
                // L[j] <= i <= R[j]
                // i - 1 : 0 ~ (i - 1 - L[j]) -> i : 0 ~ (i - L[j])
                // + way[i - L[j]]
                sum[j] = (sum[j] + way[i - L[j]]) % mod;
                way[i] = (way[i] + sum[j]) % mod;
            }
        }
    }
    cout << way[N - 1] << '\n';
    return 0;
}

Measured memory_bytes: 4780
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
		String s;
		String sl[];

		s = r.readLine();
		sl = s.split(" ");

		int n = Integer.parseInt(sl[0]);

		s = r.readLine();
		sl = s.split(" ");
		int a[] = new int[n];
		boolean b[] = new boolean[1000001];

		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sl[i]);
		}

		Arrays.sort(a);

		int pre = -1;

		for (int i = 0; i < n; i++) {
			if(b[a[i]])
			{
				continue;
			}
			if(pre == a[i])
			{
				pre = a[i];
				b[a[i]] = true;
				continue;
			}
			pre = a[i];
			for(int j = a[i] * 2; j <= 1000000; j += a[i])
			{
				b[j] = true;
			}
		}

		int v = 0;
		for(int i = 0; i < n; i++)
		{
			if(!b[a[i]]) v++;
		}

		System.out.println(v);
	}
}

Measured memory_bytes: 72732
#include<iostream>
#include<iomanip>

using namespace std;
int main(){
    int n;
    double a,sum;
    cin>>n;

    sum=0;
    for(int i=0; i<n; i++){
        cin>>a;
        sum+=1.0/a;
    }
    cout<<fixed<<setprecision(16)<<1.0/sum<<endl;

    return 0;
}

Measured memory_bytes: 256
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
#define endl '\n'
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define sz(v) (int)v.size() 
#define UB upper_bound
#define LB lower_bound
#define BP(x) __builtin_popcountll(x)
#define OST tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getRand(int l, int r) {
  uniform_int_distribution<int> uid(l, r);
  return uid(rng);
}

const int INF = 1e18 + 0;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const int L = 62;

int basis[L], bsize;

void prepare(int mask) {
  for(int i = 0; i < L; i++) {
    if((mask&(1ll<<i))) {
      if(!basis[i]) {
        basis[i] = mask; bsize++;
        return;
      }
      mask ^= basis[i];
    }
  }
}

bool ok(int mask) {
  for(int i = 0; i < L; i++) {
    if((mask&(1ll<<i))) {
      if(!basis[i]) {
        return 0;
      }
      mask ^= basis[i];
    }
  }
  return 1;
}

void solve() {
    memset(basis,0, sizeof(basis));
    int n; cin >> n;
    int data[n+5];
    for(int i = 1; i <= n; i++) {
      cin >> data[i];
    }
    string s; cin >> s;
    reverse(all(s));
    reverse(data+1, data+n+1);
    for(int i = 0; i < sz(s); i++) {
      if(s[i] == '0') {
        prepare(data[i+1]);
      } else {
        if(!ok(data[i+1])) {
          cout << "1\n"; return;
        }
      }
    }
    cout << "0\n";
}

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

  #ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
  #endif
   int t = 1;  cin >> t;
   for(int i = 1; i <= t; i++) {
     solve();
  }
}    


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main()
{
    ll n, sum = 0;
    cin >> n;
    vector<ll> a(n), ans(n);
    rep(i, n)
    {
        cin >> a[i];
        sum += a[i];
    }
    ll asum = 0;
    rep(i, n)
    {
        if (i % 2 == 1)
            asum += a[i];
    }
    ans[0] = sum - 2 * asum;
    for (int i = 0; i < n - 1; i++)
    {
        ans[i + 1] = 2 * a[i] - ans[i];
    }
    rep(i, n)
    {
        cout << ans[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 2944
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			String s = sc.next();
			char ans = 'd';
			for(int i=0;i<3;i++) {
				if(s.charAt(3*i) != 's' && s.charAt(3*i) == s.charAt(3*i+1) && 
				   s.charAt(3*i) == s.charAt(3*i+2)) ans = s.charAt(3*i);
				if(s.charAt(i) != 's' && s.charAt(i) == s.charAt(3+i) &&
				   s.charAt(i) == s.charAt(6+i)) ans = s.charAt(i);
			}
			if(s.charAt(0) != 's' && s.charAt(0) == s.charAt(4) && 
			   s.charAt(0) == s.charAt(8)) ans = s.charAt(0);
			if(s.charAt(2) != 's' && s.charAt(2) == s.charAt(4) &&
			   s.charAt(6) == s.charAt(2)) ans = s.charAt(2);
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <bitset>
#include <time.h>
#include <set>
#include <algorithm>
#define MODD 1000000007
#define ll long long
using namespace std;

int n,k;
int A[111];
int dp[111][256];
ll fact[111];

int main() {
    cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>A[i];
    
    for(int i=0;i<=255;i++)
        dp[0][i]=0;
    
    dp[0][0]=1;
    
    
    for(int i=1;i<=n;i++) {
        for(int len=n;len>=1;len--) {
            for(int j=0;j<=255;j++) {
                dp[len][j]=(dp[len][j]+dp[len-1][j^A[i]])%MODD;
            }
        }
    }
    
    fact[0]=1;
    for(int i=1;i<=n;i++)
        fact[i]=(fact[i-1]*i)%MODD;
    
    ll ans = 0;
    for(int len=0;len<=n;len++) {
        ans = (ans + dp[len][k]*fact[len])%MODD;
    }
    
    cout << ans << endl;
    

    

}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string.h>
#include <algorithm>
#include <cstring>
#include <queue>
#include <assert.h>
#include <cmath>
#include <stack>
#include <deque>
#include <set>
#include <unordered_map>
#include <complex>
#include <fstream>
#include <map>
#include <numeric>
#include <functional>

#include <algorithm>
#include <cassert>
#include <vector>

namespace atcoder {

// Implement (union by size) + (path compression)
// Reference:
// Zvi Galil and Giuseppe F. Italiano,
// Data structures and algorithms for disjoint set union problems
struct dsu {
  public:
    dsu() : _n(0) {}
    dsu(int n) : _n(n), parent_or_size(n, -1) {}

    int merge(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        int x = leader(a), y = leader(b);
        if (x == y) return x;
        if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
        parent_or_size[x] += parent_or_size[y];
        parent_or_size[y] = x;
        return x;
    }

    bool same(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        return leader(a) == leader(b);
    }

    int leader(int a) {
        assert(0 <= a && a < _n);
        if (parent_or_size[a] < 0) return a;
        return parent_or_size[a] = leader(parent_or_size[a]);
    }

    int size(int a) {
        assert(0 <= a && a < _n);
        return -parent_or_size[leader(a)];
    }

    std::vector<std::vector<int>> groups() {
        std::vector<int> leader_buf(_n), group_size(_n);
        for (int i = 0; i < _n; i++) {
            leader_buf[i] = leader(i);
            group_size[leader_buf[i]]++;
        }
        std::vector<std::vector<int>> result(_n);
        for (int i = 0; i < _n; i++) {
            result[i].reserve(group_size[i]);
        }
        for (int i = 0; i < _n; i++) {
            result[leader_buf[i]].push_back(i);
        }
        result.erase(
            std::remove_if(result.begin(), result.end(),
                           [&](const std::vector<int>& v) { return v.empty(); }),
            result.end());
        return result;
    }

  private:
    int _n;
    // root node: -1 * component size
    // otherwise: parent
    std::vector<int> parent_or_size;
};

}  // namespace atcoder

using namespace std;
using namespace atcoder;
const int mxn = 1e5+10;


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

	int n, q; cin>>n>>q;
	dsu d(n);
	while(q--) {
		int t, u, v; cin>>t>>u>>v;
		if(!t) {
			d.merge(u, v);
		}
		else {
			cout << d.same(u, v) << '\n';
		}
	}

	return 0;
}
//comparator function in sorting
//swapping arguments
//missing cases in dp
//dividing in modulo
//Beware of overflow and modulo
//Be mindful of overflow
//s is a matrix but forget
//length of ranges
//working with bit using ull


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

int main()
{
	string s, ans;
	cin >> s;
	
	for (auto i: s) if (i=='B') {
		if (ans.size()) ans.pop_back();
	}
	else ans.push_back(i);
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
//In the name of Allah
#include <bits/stdc++.h>
using namespace std;
#define MAX 3011
#define mod 1000000007
#define inf 1000000000000000000
#define ll long long
#define endl '\n'
int n;
ll dp[MAX][MAX][2],a[MAX];
ll memo(int i,int j,bool b){
	if(i == j){
		if(!b) return a[i];
		else return -a[i];
	}

	if(dp[i][j][b] != inf)return dp[i][j][b];
	
	if(!b)
		dp[i][j][0] = max(memo(i + 1, j,1) + a[i],memo(i,j-1,1) + a[j]);
	else
		dp[i][j][1] = min(memo(i + 1, j,0) - a[i],memo(i,j-1,0) - a[j]);
	
	return dp[i][j][b];
}

int main() {
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i = 0; i < n ; i++)cin>>a[i];
	
	for(int i = 0; i < n ; i++)
		for(int j =0 ; j < n; j++)
			dp[i][j][0] = dp[i][j][1] = inf;
	
	cout<<memo(0,n-1,0);
	return 0; 
} 

Measured memory_bytes: 141824
n, m, q = map(int, input().split())

A = [[0]*n for i in range(n)]

for i in range(m):
    l, r = map(int, input().split())
    l, r = l-1, r-1
    A[l][r] += 1

#print(A)

s = [[0]*(n+1) for _ in range(n+1)]
for i in range(n):
  for j in range(n):
    s[i+1][j+1] = s[i+1][j] + s[i][j+1] - s[i][j] + A[i][j]

#print(s)

for i in range(q):
    p, q = map(int, input().split())
    p, q = p-1, q-1
    ans = s[q+1][q+1] - s[p][q+1] - s[q+1][p] + s[p][p]
    print(ans)


Measured memory_bytes: 79924
#include <bits/stdc++.h>
#define L long long
#define LL long long
#define SS string
#define PB push_back
#define pp pair<L,L>
#define f(x, n , i) for (i = x ; i <= n ; i++)
#define setE(a, x , size) memset(a,x,size);
#define N 100500
#define INFY 1000000000000000000
using namespace std;
L matrix[101][N];
int main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    L n , w;
    cin >> n >> w;
    L i;
    L wt[n+1] , vl[n+1];
    f(1,n,i)
{
    cin >> wt[i] >> vl[i];
}
L j;
f(0,n,i)
{
    f(0,N,j)
    {
        matrix[i][j] = INFY;
        if (j == vl[i] && i != 0)
        {
            matrix[i][j] = wt[i];
        }
    }
}
f(1,n,i)
{
    f(0,N,j)
    {
        if (matrix[i-1][j] != INFY)
        {
                matrix[i][j] = min(matrix[i-1][j],matrix[i][j]);
            if (matrix[i-1][j] + wt[i] <= w)
            {
                matrix[i][j+vl[i]] = min(matrix[i-1][j] + wt[i],matrix[i][j+vl[i]]);
            }
         }
    }
}
L answer = -1;
f(1,n,i)
{
    f(0,N,j)
    {
        if (matrix[i][j] != INFY)
        {
            answer = max(answer,j);
        }
    }
}
cout << answer;
    return 0;
}

Measured memory_bytes: 79616
s=input()
t=input()
d=dict()
flag=True
ds=set()
for i in range(len(s)):

  if not(t[i] in d):
    if s[i] in ds:
      flag=False
      break
    d[t[i]]=s[i]
    ds.add(s[i])
  else:
    if d[t[i]]!=s[i]:
      flag=False
      break
if flag:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3632
a,b,k = map(int, input().split())

ab = [a,b]
for i in range(k):
    p = i%2
    if ab[p]%2 == 1:
        ab[p] -= 1
    half = ab[p]/2
    ab[p] -= half
    ab[1-p] += half

print(int(ab[0]), int(ab[1]))


Measured memory_bytes: 2940
import * as fs from 'fs';

namespace AtCoder {
    export interface Paramable {
        readonly args: string[][];
    }

    export interface Task {
        main(this: Task): void;
    }
}

namespace AtCoder.abc001 {
    export class TaskA implements AtCoder.Task, AtCoder.Paramable {
        public constructor(public readonly args: string[][]) {
        }

        public main(this: TaskA): void {
            const x: number = +this.args[0][0];


            let xx = 100;
            let ans = 0;

            while (x > xx) {
                xx += Math.floor((xx*0.01));
                ans++;
            }
            console.log(ans);
        }
    }

    const args: string[][] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n').map(r => r.split(' '));
    const task: AtCoder.Task = new TaskA(args);
    task.main();
}



Measured memory_bytes: 29772
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void)
{
	int x;
	vector<int> vc;

	cin >> x;
	vc.push_back(x);
	cin >> x;
	vc.push_back(x);
	cin >> x;
	vc.push_back(x);
	sort(vc.begin(), vc.end());
	cout << vc[2] * 10 + vc[1] + vc[0];
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

typedef long long llint;

llint k, n=50, sum, c;
llint d[55], a[55];

int main () {
	cin >> k;
	for (int i=0; i<n; i++) {
		d[i]=(k+1)/(n+1);
		sum+=d[i];
	}
	c=(k-sum)/n;
	for (int i=0; i<n; i++) {
		d[i]+=c;
		sum+=c;
	}
	int ind=0;
	while (sum<k) {
		d[ind]++;
		sum++;
		ind++;
		if (ind==n) ind=0;
	}
	cout << n << endl;
	for (int i=0; i<n; i++) {
		a[i]=n*d[i]+n+d[i]-k-1;
		cout << a[i] << " ";
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String args[]){
		
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int a=0;
		int length;
		
	
	
	    if(s.contains("eraser")){
		     s= s.replace("eraser","");
	    }
		
		if(s.contains("erase")){
		    s= s.replace("erase","");
			
		}
		
		if(s.contains("dreamer") ){
		 s= s.replace("dreamer","");
		}

		if(s.contains("dream")){
		s= s.replace("dream","");
		}
		
		if(s.equals("")){
			System.out.println("YES");
		}
		
		else{
				System.out.println("NO");
		}
			
		
		
		
		
	
	}
}

Measured memory_bytes: 29292
#include <bits/stdc++.h>
using namespace std;
constexpr long N = 300000;
constexpr long mod = 998244353;

inline long mpow(long a, long p){
    long x=a;
    long y=1;
    while(p>0){
        if((p&1)==1){
            y=x*y%mod;
        }
        x=x*x%mod;
        p>>=1;
    }
    return y;
}

inline long minv(long a){
    return mpow(a, mod-2);
}

long fact[N+1];
long ncr[N/2+1];
inline void init_ncr(long n){
    long t=1;
    fact[0]=1;
    for(long i=1; i<=N; i++){
        t=t*i%mod;
        fact[i]=t;
    }
    for(long r=0; r<=n/2; r++){
        ncr[r] = fact[n]*minv(fact[n-r]*fact[r]%mod)%mod;
    }
}

inline long mcomb(long n, long r){
    return r>n/2 ? ncr[n-r] : ncr[r];
}

int main(void){
    long n, a, b, k;
    scanf("%ld %ld %ld %ld", &n, &a, &b, &k);
    init_ncr(n);
    long sum = 0;
    const long s = max(0l, (k-n*b)/a);
    const long e = min(n, k/a);
    for(long i=s; i<=e; i++){
        long q=(k-a*i)/b;
        long m=(k-a*i)%b;
        if(m==0){
            sum = (sum+mcomb(n,i)*mcomb(n,q))%mod;
        }
    }
    if(sum==0)sum++;
    printf("%ld\n", sum);
    return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

const ll INF = 100000 * 10000;

signed main() {
  ll N, M;
  cin >> N >> M;
  vector<ll> price(M+1);
  vector<ull> item(M+1, 0);
  rep(i, M) {
    ll len;
    cin >> price[i+1] >> len;
    rep(j, len) {
      ll x;
      cin >> x;
      x--;
      item[i+1] |= 1<<x;
    }
  }
  //rep(i, M) {
  //  printf("%d 0x%02X\n", price[i+1], item[i+1]);
  //}
  vector<ll> dp(1<<14, INF);
  dp[0] = 0;
  for (ll i=1; i<=M; i++) {
    rep(bit, 1<<14) {
      if (dp[bit] == INF)
        continue;
      dp[bit | item[i]] = min(dp[bit | item[i]], dp[bit] + price[i]);
      // printf("dp[0x%02X] = %d\n", bit | item[i], dp[bit + item[i]]);
    }
  }

  ll ans = dp[(1<<N)-1];
  if (ans == INF) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 384
n, m, x = map(int, input().split())
A= list(map(int, input().split()))
cost1 = 0
cost2 = 0
now1 = x
now2 = x
while now1 < n:
    now1 += 1
    if now1 in A:
        cost1 += 1
while now2 > 0:
    now2 -= 1
    if now2 in A:
        cost2 += 1
print(min(cost1, cost2))

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

public class Main{
    public static void main(String args[]) {
        //  System.out.println("Hello World!");
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int[] ar=new int[n];
        for (int i=0;i<n;i++){
            ar[i]=in.nextInt();
        }
        int[] dp=new int[n];
        Arrays.fill(dp,-1);

        int ans=go(ar,0,dp);


        System.out.println(ans);
    }
    static int go(int[] ar,int i,int[] dp){
        if (i==ar.length-1){
            return 0;
        }
        if (dp[i]!=-1){
            return dp[i];
        }
        int jump1=Integer.MAX_VALUE,jump2=Integer.MAX_VALUE;
        if (i+1<ar.length){
            jump1=Math.abs(ar[i]-ar[i+1])+go(ar,i+1,dp);
        }
        if (i+2<ar.length){
            jump2=Math.abs(ar[i]-ar[i+2])+go(ar,i+2,dp);
        }
        return dp[i]=Math.min(jump1,jump2);
    }
}

Measured memory_bytes: 62924
def f(a, b, x):
    return (a * x) // b - a * (x // b)


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

    if n < b - 1:
        x = n
    else:
        x = b - 1

    print(f(a, b, x))


if __name__ == "__main__":
    main()


Measured memory_bytes: 61700
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  ll n;
  cin >> n;
  ll dp[n];
  rep(i,n){
    cin >> dp[i];
    if(i==0){
      continue;
    }
    dp[i] = dp[i] + dp[i - 1];
  }
  ll mini = INF;
  rep(i,n-1){
    ll tmp = abs(dp[n - 1] - 2*dp[i]);
    chmin(mini, tmp);
  }
  print(mini);
}


Measured memory_bytes: 5100
def next(r, D, x_before):
	return r*x_before - D

inputs = list(map(int, input().split(' ')))[:3]
r = inputs[0]
D = inputs[1]
x2000 = inputs[2]

x_cur = next(r,D,x2000)

for i in range(1,11):
	print(x_cur)
	x_cur = next(r,D,x_cur)


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

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define FOR(n) for(int i = 0;i < n;i++)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define ipow(x,y) LL(pow(x,y))

//Debug
#define TEST cout << "OK\n"

const double PI = M_PI;
const long long INF = int(10e9-1);
const long long MOD = int(10e9+7);

//Settings
const bool DO_BENCHMARK = false;
const int DOUBLE_ACCURACY = 15;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t clock_start = clock();
        solve();
        clock_t clock_end = clock();
        const double time = static_cast<double>(clock_end-clock_start)/CLOCKS_PER_SEC*1000.0;
        cout << "\n" << time << "[ms]\n";
    }
    else solve();
}

void solve(){
    int N;
    cin >> N;
    for(int i = 0;i < 50000;i++){
        if(int(i*1.08) == N){
            cout << i << endl;
            ED;
        }
    }
    cout << ":(" << endl;
}


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

int main(){
  string S, T;
  cin >> S >> T;

  bool even = false;
  for (int i=0; i<S.size(); i++){
    char tmp;
    tmp = S.at(S.size()-1);
    for (int j=S.size()-2; j>=0; j--){
      S.at(j+1) = S.at(j);
    }
    S.at(0) = tmp;
    if (S==T){
      even = true;
    }
  }
  cout << (even? "Yes":"No") << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int marge(int*,int,int,int);
int mergeSort(int*,int,int);

int main(){
  int n,*s,i,cnt;

  scanf("%d",&n);
  s= (int*)malloc(n*sizeof(int));
  for(i=0;i<n;i++) scanf("%d",&s[i]);

  cnt=margeSort(s,0,n);

  for(i=0;i<n;i++){
    printf("%d",s[i]);
    if(i!=n-1) printf(" ");
  }
  printf("\n%d\n",cnt);

  free(s);
  return 0;
}

int margeSort(int A[],int left,int right){
  int mid,i;
  int cnt=0;/* すべての比較回数をまとめておく */
  if(left+1<right){
    mid =(left+right)/2;
    cnt+=margeSort(A,left,mid);
    cnt+=margeSort(A,mid,right);
    cnt+=merge(A,left,mid,right);
  }
  
  return cnt;
}

int merge(int A[],int left,int mid,int right){
  int n1,n2,*L,*R,i,j,k,cnt=0;

  n1=mid-left;
  n2=right-mid;


  L=(int *)malloc((n1+1)*sizeof(int));
  R=(int*)malloc((n2+1)*sizeof(int));

  for(i=0;i<n1;i++) L[i]=A[left+i];
  for(i=0;i<n2;i++)  R[i]=A[mid+i];
   

  L[n1]=1000000001;/* この数より上回らないため */
  R[n2]=1000000001;

  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
    }
    else{
      A[k]=R[j];
      j++;
    }
    cnt++;
  }
  free(L);
  free(R);

  return cnt;
}



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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int n, m;
  cin >> n >> m;
  if (m % n == 0) {
    cout << m / n << endl;
    return;
  }
  vector<int> dv;
  for (int i = 1; i * i <= m; i++) {
    if (m % i == 0) {
      dv.push_back(i);
      if (i * i != m) {
        dv.push_back(m / i);
      }
    }
  }
  sort(dv.begin(), dv.end(), greater<int>());
  dump(dv);
  int ans = 0;
  rep(i, dv.size()) {
    if ((ll)m >= (ll)dv[i] * n) {
      ans = dv[i];
      break;
    }
  }
  dump(ans);
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

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

using namespace std;

int main(int argc, const char *argv[]) {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (abs(a - c) <= d) {
    cout << "Yes\n";
    return 0;
  }
  
  if (abs(a - b) <= d && abs(b - c) <= d) {
    cout << "Yes\n";
    return 0;
  }

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        int judge[], i, n, max, min, ave;
        Scanner sc = new Scanner(System.in);
        while(true){
            n = sc.nextInt();
            if(n == 0)break;
            judge = new int[n];
            ave = 0;
            max = -1;
            min = 1001;
            for(i = 0; i < n; i++){
                judge[i] = sc.nextInt();
                if(judge[i] > max) max = judge[i];
                if(judge[i] < min) min = judge[i];
                ave += judge[i];
            }
            ave -= (max + min);
            ave /= i - 2;
            System.out.println(ave);
        }
    }
}

Measured memory_bytes: 20940
while True:
  n,x=map(int,input().split())
  if n==0 and x==0:
    break
  else:
    count=0
    for i in range(1,n-1):
      for j in range(i+1,n):
        for k in range(j+1,n+1):
          if i+j+k==x:
            count=count+1
  print(count)


Measured memory_bytes: 5592
#include<cstdio>
#include<algorithm>
using namespace std;
int a,b,k,i;
int main() {
	scanf("%d %d %d",&a,&b,&k);
	for(i=a;i<=min(a+k-1,b);i++)
		printf("%d\n",i);
	for(i=max(i,b-k+1);i<=b;i++)
		printf("%d\n",i);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  double ans=0;
  rep(i,n) {
    double x;
    R x;
    ans+=1.0/x;
  }
  pd(1.0/ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a = list(input())
b = list(input())
c = list(input())
game = [a, b, c]
ans = ['A', 'B', 'C']
memo = 0
for i in range(len(a) + len(b) + len(c)):
    check = game[memo].pop(0)
    if check == 'a':
        memo = 0
    elif check == 'b':
        memo = 1
    else:
        memo = 2
    if len(game[memo]) == 0:
        break
print(ans[memo])


Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>

using namespace std;

const int K = 100000;

long long qu[K];

void generate() {
	int head = 0, cnt = 0, x = 0;
	for (int a = 1; a <= 9; a++)
		qu[head + cnt++] = a, x++;
	while (x < K) {
		long long a = qu[cnt--, head++];
		for (int t = -1; t <= 1; t++) {
			int d = a % 10 + t;
			if (d >= 0 && d <= 9 && x < K)
				qu[head + cnt++] = a * 10 + d, x++;
		}
	}
}

int main() {
	int k; cin >> k, k--;
	generate();
	cout << qu[k] << '\n';
	return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
	char S[10], check = 0;

	scanf("%s", S);
	/*for (int i = 0; i < 10; i++) {
		scanf("%c", &S[i]);*/
	//printf("%s", S);
	
	int count = 0;

	int Max = 0;

	for (int i = 0; i < 10; i++) {
		if (S[i] == 'A') {
			count++;
			if (count >= Max)
				Max = count;
		}
		else if (S[i] == 'T') {
			count++;
			if (count >= Max)
				Max = count;
		}
		else if (S[i] == 'C') {
			count++;
			if (count >= Max)
				Max = count;
		}
		else if (S[i] == 'G') {
			count++;
			if (count >= Max)
				Max = count;
		}

		

		
		

		else {
			if (count >= Max) {
				Max = count;

				count = 0;
			}
			else
				count = 0;
			}



		}

	printf("%d", Max);

	return 0;
}


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

#define int long long
using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    bool flag = false;
    while (n) {
        if (n % 10 == 7) flag = true;
        n /= 10;
    }
    if (flag) cout << "Yes";
    else cout << "No";
    return 0;
}

Measured memory_bytes: 3648
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    map <int,int> cnt;
    int n,ans=0; cin>>n; 
    while (n--){
        int a; cin>>a; 
        cnt[a]++;
    }
    for (auto &it: cnt){
        if (it.ff>it.ss) ans += it.ss;
        else ans += it.ss-it.ff;
    }
    cout << ans << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


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

int main() {
  int K;
  cin >> K;
  
  int count = 0;
  for( int i = 1; i <= K; i++ ){
    for( int j = i+1; j <= K; j++ ){
      if( i % 2 == 0 && j % 2 == 1 ){
        count++;
      }else if( i % 2 == 1 && j % 2 == 0 ){
        count++;
      }
    }
  }
  cout << count << endl;
}

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

int main(){
  int n;cin>>n;
  string s,t;
  cin>>s>>t;
  for(int i=0;i<n;i++){
    if(s.substr(i,n-i)==t.substr(0,n-i)){
      cout<<i+n<<endl;
      return 0;
    }
  }
  cout<<2*n<<endl;
  return 0;
}

Measured memory_bytes: 888
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define RREP(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    int n;
    string s;
    cin >> s;
    n = s.size();
    string res = "";
    for(int i=0;i<n;res.push_back(s[i]),i+=2);
    put(res);
    return 0;
}


Measured memory_bytes: 512
chomp($t = <>);

$cnt = 2;
$f{$t} = 1;
while(1){
	$t = ($t % 2 == 0) ? ($t / 2) : (($t * 3) + 1);
	last if($f{$t} == 1);
	$f{$t} = 1;
	$cnt++;
}

print "$cnt\n";


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;


const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    int N,K; cin >> N >> K;
    vector<int> A(N);
    for(int i=0;i<N;i++) cin >> A[i];
    cout << (N+K-3)/(K-1) << endl;
}


Measured memory_bytes: 640
#include<stdio.h>
int main()
{
  int a,b,c,d,e;
  scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
  if(a==0)
    printf("1");
  else if(b==0)
    printf("2");
  else if(c==0)
    printf("3");
  else if(d==0)
    printf("4");
  else
    printf("5");
  return 0;
}

Measured memory_bytes: 1644
#include <queue>
#include <cstdio>
#include <algorithm>
using namespace std;
#define Maxn 200000
int tmp[Maxn+5];
struct Person{
    int l,r;
    friend bool operator <(Person p,Person q){
        if(p.l==q.l){
            return p.r<q.r;
        }
        return p.l<q.l;
    }
}a[Maxn+5];
priority_queue<int,vector<int>,greater<int> > q;
int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++){
        scanf("%d%d",&a[i].l,&a[i].r);
    }
    sort(a+1,a+1+n);
    int h=1,len=0;
    for(int i=1;i<=n;i++){
        q.push(a[i].r);
        if(h<=a[i].l){
            h++;
        }
        else{
            tmp[++len]=q.top();
            q.pop();
        }
    }
    sort(tmp+1,tmp+1+len);
    int ans=0,t=m;
    for(int i=len;i>0;i--){
        if(t>=h&&t>=tmp[i]){
            t--;
        }
        else{
            ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 3192
// atcoder/abc144/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int a, b;
  while (cin >> a >> b) {
    if (max(a, b) <= 9) cout << a * b << endl;
    else cout << -1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
d=raw_input().split(" ")
l=list(map(int,d))
if(l[2]>0 and l[3]>0):
    if(l[0]>=(l[2]+l[4])):
        if(l[1]>=(l[3]+l[4])):
            print "Yes"
        else:
            print "No"
    else:
        print "No"
else:
   print "No"


Measured memory_bytes: 4644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
const int mod = 1000000007;
int a,b;
int main(){
  cin >> a >> b;

  cout << (a < 10 && b < 10 ? a*b:-1) << endl; 
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string.h>

using namespace std;

int main()
{
	int ans = 100000;
	int n;
	int tmp;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		ans += ans*0.05;
		if (ans % 1000 != 0) {
			ans = (ans / 1000) * 1000 + 1000;
		}
	}
	cout << ans<<endl;
	return 0;
}

Measured memory_bytes: 1160