akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int A, B, C;
  scanf("%d%d%d", &A, &B, &C);

  int f = A % B;
  int x = A;
  while (x % B != C) {
    x += A;
    if (x % B == f) {
      printf("NO");
      return 0;
    }
  }

  printf("YES");
  return 0;
}

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

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2")

using namespace std;

#define int long long
#define sz(a) (int) (a).size()
#define all(a) (a).begin(), (a).end()
#define x first
#define y second

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

void solve() {
    int n, k;
    cin >> n >> k;
    int ans = n;
    if (n >= k) {
        n %= k;
        ans = min(n, ans);
    }
    if (n <= k) {
        ans = min(ans, k - n);
    }
    cout << ans << "\n";
}

signed main() {
    ios::sync_with_stdio(false);
//    cin.tie(0), cout.tie(0);

    int t;
//    cin >> t;
t = 1;
    while (t--) {
        solve();
    }

    return 0;
}

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

namespace Practice
{
    class Program
    {
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        static void Main(string[] args)
        {
            SolveA(args);
            //SolveB(args);
            //SolveC(args);
            //SolveD(args);


        }
        private struct Pos
        {
            public int row;
            public int col;
        }
        private const long MOD = 1000000007;
        static void SolveA(string[] args)
        {
            int n = ReadAndParseInt();
            int a = ReadAndParseInt();

            n %= 500;
            if( n <= a)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define MAXN 1005
using namespace std;

int n;
pair<int, int> v[MAXN];
set<int> vals;
map<int, vector<int>> valCode;
vector<int> d;
long long sumd;

void getds(int maxval) {
    if (maxval & 1) {
        int k;
        for (k = 0; ; ++k) {
            if ((1LL << (k + 1)) - 1 >= maxval)
                break;
        }

        sumd = (1LL << (k + 1)) - 1;
        for (int i = 0; i <= k; ++i)
            d.push_back(1 << i);
    }
    else {
        int k;
        for (k = 1; ; ++k) {
            if ((1LL << (k + 1)) - 2 >= maxval)
                break;
        }

        sumd = (1LL << (k + 1)) - 2;
        for (int i = 0; i <= k; ++i)
            d.push_back(1 << i);
        d.back()--;
    }
}

vector<int> getValCode(int x) {
    vector<int> ans(d.size(), 1);

    long long crtS = sumd;
    for (int i = (int) d.size() - 1; i >= 0; --i) {
        if (crtS - 2LL * d[i] >= x) {
            crtS -= 2LL * d[i];
            ans[i] = -1;
        }
    }

    assert(crtS == x);
    return ans;
}

vector<int> swapSigns(const vector<int> &v) {
    vector<int> ans;
    for (auto x: v)
        ans.push_back((x == 1) ? -1 : 1);
    return ans;
}

string getSol(int x, int y) {
    const vector<int> &sumCode = valCode[x + y];
    const vector<int> &difCode = valCode[x - y];

    string ans;

    for (int i = 0; i < (int) sumCode.size(); ++i) {
        int xcode = (sumCode[i] + difCode[i]) >> 1;
        int ycode = (sumCode[i] - difCode[i]) >> 1;
    
        assert(xcode == 0 || ycode == 0);
        if (xcode == 0)
            ans.push_back(ycode == 1 ? 'U' : 'D');
        else
            ans.push_back(xcode == 1 ? 'R' : 'L');
    }

    return ans;
}

int main() {
    ios::sync_with_stdio(0);

    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> v[i].first >> v[i].second;
        vals.insert(abs(v[i].first + v[i].second));
        vals.insert(abs(v[i].first - v[i].second));
    }

    int par = *vals.begin() & 1;
    for (auto x: vals) {
        if ((x & 1) != par) {
            cout << "-1\n";
            return 0;
        }
    }

    getds(*vals.rbegin());
    for (auto x: vals) {
        valCode[x] = getValCode(x);
        valCode[-x] = swapSigns(valCode[x]);
    }

    cout << d.size() << "\n";
    for (auto x: d)
        cout << x << " ";
    cout << "\n";

    for (int i = 1; i <= n; ++i)
        cout << getSol(v[i].first, v[i].second) << "\n";

    return 0;
}

Measured memory_bytes: 1280
N, M  = list(map(int, input().split()))
L = []
R = []

for m in range(M):
    L_in, R_in = list(map(int, input().split()))
    L.append(L_in)
    R.append(R_in)

if min(R) >= max(L):
    print(min(R) - max(L) + 1)
else:
    print(0)


Measured memory_bytes: 11048
#include <stdio.h>

int main(){
  int a,b,x;
  scanf("%d%d%d",&a, &b, &x);
  if((a+b)<x)
    printf("NO\n");
  else if(a>x)
    printf("NO\n");
  else
    printf("YES\n");
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#define fore(i,x,y) for(long long i=x;i<y;i++)
typedef long long ll;
using namespace std;
int main()
{
	int N,A;
	cin >> N >> A;
	cout << N*N-A << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{

    int h,n,i=0,sum=0;
    scanf("%d %d",&h,&n);
    int a[n];
    while(i<n)
    {

        scanf("%d",&a[i]);
        sum+=a[i];
        i++;
    }

    if(sum>=h)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
    return 0;

}


Measured memory_bytes: 512
#入力
n = int(input())
v = [i for i in map(int, input().split())]
c = [i for i in map(int, input().split())]
#コストが大きい石は取らない
lst = []
buy = []
for i in range(n):
    lst.append(v[i]-c[i])
    if lst[i] > 0:
        buy.append(lst[i])
print(sum(buy))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <array>
#include <utility>
#include <queue>
#include <tuple>
#include <map>
#include <cmath>
using namespace std;
using ll = long long;
constexpr ll INF = 1000000007;

int main() {
    int n, k; cin >> n >> k;
    vector<vector<int>> list;
    vector<int> input, chk;

    for (int i = 0; i < k; i++) {
        input.clear();
        int d; cin >> d;
        for (int j = 0; j < d; j++) {
            int inp; cin >> inp;
            chk.push_back(inp);
            input.push_back(inp);
        }
        list.push_back(input);
    }
    sort(chk.begin(), chk.end());
    decltype(chk)::iterator result = std::unique(chk.begin(), chk.end());
    chk.erase(result, chk.end());

    cout << n - chk.size() << "\n";



    /*for (int i = 0; i < list.size(); i++) {
        cout << "お菓子" << i+1 << "を持つ人... ";
        for (int j = 0; j < list[i].size(); j++) {
            cout << list[i][j] << " ";
        }
        cout << "\n";
    }*/
    
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
vector<int> cnt(22);//i-th bit が立っているか
signed main(){
    int n;cin >> n;
    int a[n];
    rep(i,n)cin >> a[i];
    int l = 0,r = 0;
    int ans = 0;
    rep(i,n){
        int nextl = i,nextr = n;
        while(l < nextl){
            rep(j,22)if(a[l]>>j&1)cnt[j] = 0;
            l++;
        }
        while(r < nextr){
            bool ok = true;
            rep(j,22){
                if(a[r]>>j&1){
                    if(cnt[j]){
                        ok = false;
                        break;
                    }
                    
                }

            }
            if(ok){
                rep(j,22)if(a[r]>>j&1)cnt[j] = 1;
            }
            else break;
            r++;
        }
        ans += r-l;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, a, b, c;
  cin >> n;
  if(n % 1111 == 0){
    cout << "Yes" << endl;
  }else if(n % 1110 < 10){
    cout << "Yes" << endl;
  }else if(n % 1000 % 111 == 0) {
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <array>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <climits>
#include <utility>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <complex>
#include <numeric>
#include <chrono>
#include <cmath>
#include <bitset>

using namespace std;

#define FOR(it, ar) for(auto &it: ar)
#define loop(i, start, end) for(auto i = (start); i <= (end); i++)
#define loopSkip(i, start, end, skip) for(auto i = (start); i <= (end); i += skip)
#define loopRev(i, start, end) for(int i = (start); i >= (end); i--)
#define FLASH ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define testCases(t) cin >> t; while(t--)
#define PN(n) cout << (n)
#define PN1(n) cout << (n) << " "
#define PN2(a, b) cout << (a) << " " << (b) << " "
#define PN3(a, b, c) cout << (a) << " " << (b) << " " << (c) << " "
#define PNN1(n) cout << (n) << "\n"
#define PNN2(a, b) cout << (a) << " " << (b) << "\n"
#define PNN3(a, b, c) cout << (a) << " " << (b) << " " << (c) << "\n"
#define PrintObject(ar) for(auto var: ar) cout << var << " "; cout << "\n"
#define PrintMap(map) for(auto var: map) PNN2(var.first, var.second)
#define PrintPair(pair) PNN2(pair.first, pair.second)
#define IN1(n) cin >> n
#define IN2(a, b) cin >> a >> b
#define IN3(a, b, c) cin >> a >> b >> c
#define ALL(s) s.begin(), s.end()
#define ENTER PNN1("")
#define llPair std::pair<lli, lli>
#define iiPair std::pair<int, int>

// Math macros
#define M_PI 3.14159265358979323846

typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;

template <typename T>
T ii() {
	T a;
	IN1(a);
	return a;
}

struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
      // http://xorshift.di.unimi.it/splitmix64.c
      x += 0x9e3779b97f4a7c15;
      x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
      x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
      return x ^ (x >> 31);
  }

  size_t operator()(uint64_t x) const {
      static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
      return splitmix64(x + FIXED_RANDOM);
  }
};

int main(void){
	FLASH
	#ifndef ONLINE_JUDGE
		freopen("input-stream.txt", "r", stdin);
		freopen("output-stream.txt", "w", stdout);
	#endif

	int n;
	IN1(n);
	vector<lli> ar(n);
	FOR(it, ar) IN1(it);
	const lli MOD = (lli) 1e9 + 7;
	vector<lli> suffixSum(n, 0);
	suffixSum[n - 1] = ar[n - 1];
	loopRev(i, n - 2, 0) suffixSum[i] = (ar[i] + suffixSum[i + 1]) % MOD;

	lli ans = 0;

	loop(i, 0, n - 1) {
		suffixSum[i] -= ar[i];
		if(suffixSum[i] < 0) suffixSum[i] += MOD;
		ans += (suffixSum[i] * ar[i]) % MOD;
		ans %= MOD;
	}

	PNN1(ans);

	return 0;
}


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


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

int main(){
    int N,M; cin >> N >> M;
    vector<int> v(N,-1);
    int ans=-2;
    for(int i=0;i<M;i++){
        int s,c; cin>>s >> c;s--;
        if(v[s]==-1) v[s]=c;
        else if(v[s]!=c) ans=-1;
    }

    if(v[0]==0&&N!=1) ans=-1;

    if(ans==-2){
        ans=0;
        for(int i=0;i<N;i++){
            if(v[i]==-1)continue;
            else ans+=v[i]*pow(10,N-i-1);
        }
        if(v[0]==-1 || v[0]==0) ans+=1*pow(10,N-1);
        if(N==1&&(v[0]==0||v[0]==-1)) ans=0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    string s;
    cin>>s;
    int z=0;
    rep(i,s.size()-1){
        if(s[i]==s[i+1]){
            cout<<i+1<<" "<<i+2;
            z=1;
            break;
        }
        if(s[i]==s[i+2]&&i<s.size()-2){
            cout<<i+1<<" "<<i+3;
            z=1;
            break;
        }
    }
    if(z==0) cout<<-1<<" "<<-1;
}

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

int main() {
    string n;
    cin >> n;

    bool answer = false;

    for(int i=0; i<3; i++) {
        
        if( n.at(i) == '7'){
        answer = true;
        }

    }

    if(answer)
    cout << "Yes" << endl;
    else
    {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 3628
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define PI (acos(-1))
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
//ll MOD = 1000000007;
ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
int H,W,N;
ll ans[505][505];
vector<ll> primes;
ll lgcd(ll p, ll q){
	if(p<q)swap(p,q);
	if(q==0)return p;
	return lgcd(q,p%q);
	
}
ll llcm(ll a, ll b){
	ll g=lgcd(a,b);
	return a/g * b;
	
}
int main(){
	int N;
	cin>>N;
	rep(i,505)rep(j,505)ans[i][j]=1;
	for(int i=2;i<=100000;i++){
		bool flag=true;
		for(int j=0;j<primes.size()&&primes[j]*primes[j]<=i;j++){
			if(i%primes[j]==0)flag=false;
		}
		if(flag)primes.pb(i);
	}
	
	rep(i,N)rep(j,N){
		
		if((i+j)%2==0){
			ans[i+1][j+1]=primes[(i+j)/2]*primes[(i-j)/2+N+(N-1)/2];
			
		}
		
	}
	rep(i,N)rep(j,N){
		if((i+j)%2==1){
			ll g1=llcm(ans[i][j+1],ans[i+2][j+1]);
			ll g2=llcm(ans[i+1][j],ans[i+1][j+2]);
			
			ans[i+1][j+1]=llcm(g1,g2)+1;
		}
	}
	if(N==2)ans[2][1]+=30;
	rep(i,N){
		rep(j,N){
			cout<<ans[i+1][j+1]<<" ";
		}
		cout<<endl;
	}
}

Measured memory_bytes: 5376
import java.util.*;
public class Main {
    Scanner sc;
     
    boolean judge(int[] x) {
        if (x[0]*x[0]+x[1]*x[1]==x[2]*x[2]) return true;
        else return false;
    }
     
    void run () {
        sc = new Scanner(System.in);
        int rec = 0,loz = 0;
        while (sc.hasNext()) {
            String[] s = sc.next().split(",");
            int[] x = new int[3];
            for (int i=0;i<3;i++) x[i] = Integer.parseInt(s[i]);
            if (x[0] == x[1] ) loz++;
            if (judge(x)) rec++;
        }
        System.out.println(rec);
        System.out.println(loz);
    }
     
    public static void main(String[] args) {
        new Main().run();
    }
}

Measured memory_bytes: 17136
#include<bits/stdc++.h>
#define N 2000005
using namespace std;
int n,m;
int v[N],u[N];
int main()
{
	scanf("%d%d",&n,&m);
	int t1,t2;
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&t1,&t2);
		if(t1==1)v[t2]=1;
		if(t2==n)u[t1]=1;
	}
	for(int i=2;i<n;i++)
	{
		if(v[i]&&u[i])
		{
			puts("POSSIBLE");
			return 0;
		}
	}
	puts("IMPOSSIBLE");
	return 0;
}

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

#define all(v) v.begin(), v.end()
typedef long long ll;
const int INT_INF = 1e9;
const ll INF = 1LL << 30;

int main() {
    ll a, b, x; cin >> a >> b >> x;

    ll aa = 0, bb = 0;
    if(a == 0) aa = 1;
    else aa = (a - 1) / x;
    bb = b / x;
    if(a == 0) cout << bb + aa << endl;
    else cout << bb - aa << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int v[7][7]={{-1,300,500,600,700,1350,1650},
                 {6,-1,350,450,600,1150,1500},
                 {13,7,-1,250,400,1000,1350},
                 {18,12,5,-1,250,850,1300},
                 {23,17,10,5,-1,600,1150},
                 {43,37,30,25,20,-1,500},
                 {58,52,45,40,35,15}};
    int a;
    while(cin >> a, a){
        int h1, m1, b, h2, m2;
        cin >> h1 >> m1 >> b >> h2 >> m2;
        a--; b--;
        if(a > b) swap(a, b);
        int p = h1*60+m1, q = h2*60+m2;
        if(v[b][a] <= 40 && ((1050 <= p && p <= 1170) || (1050 <= q && q <= 1170))){
            cout << (v[a][b]/2+49)/50*50 << "\n";
        }else {
            cout << v[a][b] << "\n";
        }
    }
    return 0;
}


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

int H, W;
char S[2000][2000];
int tate[2000][2000], yoko[2000][2000];

void tate_search(int i, int j){ // i行j列目
    int end = i, count = 0;
    while( S[end][j] == '.' && end < H ){
        end++;
        count++;
    }
    for(int k=i;k<end;k++)
        tate[k][j] = count; 
    
    if(end + 1 < H)
        tate_search(end + 1, j);
}

void yoko_search(int i, int j){
    int end = j, count = 0;
    while( S[i][end] == '.' && end < W ){
        end++;
        count++;
    }
    for(int k=j;k<end;k++)
        yoko[i][k] = count; 
    
    if(end + 1 < W)
        yoko_search(i, end + 1);
}

 
int main(){
    cin >> H >> W;
    for(int i=0;i<H;i++)
        for(int j=0;j<W;j++)
            cin >> S[i][j];
    
    // 縦方向
    for(int i=0;i<W;i++)
        tate_search(0,i);

    // 横方向
    for(int i=0;i<H;i++)
        yoko_search(i,0);

    int ans = 0, v;
    // 合計
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            v = tate[i][j] + yoko[i][j] - 1;
            if(v > ans)
                ans = v;
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 35456
package main

import "fmt"

func main() {
	var N, K, R, S, P, ans int
	fmt.Scan(&N, &K, &R, &S, &P)
	var T string
	fmt.Scan(&T)
	h := make([]byte, N)
	for i := 0; i < N; i++ {
		win := false
		if i < K { // 勝てる手を出す
			win = true
			if T[i] == 'r' {
				h[i] = 'p'
			} else if T[i] == 's' {
				h[i] = 'r'
			} else { // T[i] == 'p'
				h[i] = 's'
			}
		} else { // K回前と同じ手は出せない
			// h[i] = '?'
			if T[i] == 'r' {
				if h[i-K] != 'p' {
					h[i] = 'p'
					win = true
				}
			} else if T[i] == 's' {
				if h[i-K] != 'r' {
					h[i] = 'r'
					win = true
				}
			} else { // T[i] == 'p'
				if h[i-K] != 's' {
					h[i] = 's'
					win = true
				}
			}
		}
		if win {
			if h[i] == 'p' {
				ans += P
			} else if h[i] == 's' {
				ans += S
			} else {
				ans += R
			}
		} else {
			// このターンでは勝てないので、K回後の邪魔にならない手を出す
			if i+K < N {
				if T[i] == 'r' {
					// 今回自分が選べる手は 'r' or 's'
					if T[i+K] == 's' {
						h[i] = 's'
					} else {
						h[i] = 'r'
					}
				} else if T[i] == 's' {
					// 今回自分が選べる手は 'p' or 's'
					if T[i+K] == 'p' {
						h[i] = 'p'
					} else {
						h[i] = 's'
					}
				} else { // T[i] == 'p'
					// 今回自分が選べる手は 'r' or 'p'
					if T[i+K] == 'r' {
						h[i] = 'r'
					} else {
						h[i] = 'p'
					}
				}
			}
		}
	}
	// fmt.Println("my hands", string(h))
	fmt.Println(ans)
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define REP(i,N) for(int (i)=0;(i)<(N);(i)++)
#define REPR(i,N) for(int (i)=(N);i>=0;i--)
#define FOR (i,m,n) for(int (i)=m;(i)<(n);(i)++)

int main(){
  int A, B;
  char op;
  cin >> A >> op >> B;
  if(op=='+')cout << A+B << endl;
  else cout << A-B << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>

#define rep(i,n) for(int i=0;i<n;i++)
#define rp(i,c) rep(i,(c).size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e10,EPS=1e-9;

int main()
{
	int cs; scanf("%d",&cs);
	while(cs--)
	{
		char in[1001]; scanf("%s",in);
		int l=strlen(in),ans=0;
		while(l>1)
		{
			ans^=1;
			int a=in[l-1]+in[l-2]-'0'-'0';
			if(a>9)in[l-2]='1',in[l-1]=a-10+'0';
			else in[l-2]=a+'0',in[l-1]=0,l--;
		}
		printf("%s wins.\n",ans?"Fabre":"Audrey");
	}
	return 0;
}

Measured memory_bytes: 0
// 標準入力
var fs = require('fs'),
length = fs.fstatSync(process.stdin.fd).size,
buffer = new Buffer(length),
bytesRead = fs.readSync(process.stdin.fd, buffer, 0, length, 0),
input = buffer.toString('utf8', 0, bytesRead).split('\n');
main();
  
// ここから
function main(){
  for(var line = 1, maxLines = input[0] - 0; line <= maxLines; line++){
    var inputArray = new Int32Array(input[line].split(" ").sort(function(a,b){return a-b}));
    var longest = inputArray[2];
    var middle = inputArray[1];
    var shortest = inputArray[0];
 
      console.log((longest*longest == middle*middle + shortest*shortest) ? 'YES' : 'NO');
  }
}

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

using ll = long long;
using ii = pair<int, int>;

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

  int n;

  cin >> n;
  
  int v[4] = {INT_MAX, INT_MIN, INT_MAX, INT_MIN};
  ii pt[4];

  int x, y;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;

    ii p = make_pair(x, y);
    if (x + y < v[0]) pt[0] = p, v[0] = x + y;
    if (x + y > v[1]) pt[1] = p, v[1] = x + y;;
    if (x - y < v[2]) pt[2] = p, v[2] = x - y;;
    if (x - y > v[3]) pt[3] = p, v[3] = x - y;;
  }

  ll ans = 0;
  for (int i = 0; i < 4; i++)
    for (int j = i + 1; j < 4; j++)
      ans = max(ans, 0LL + abs(pt[i].first - pt[j].first) + abs(pt[i].second - pt[j].second));

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3604
#A
X = int(input())

if 400 <= X <= 599:
    print(8)
elif 600 <= X <= 799:
    print(7)
elif 800 <= X <= 999:
    print(6)
elif 1000 <= X <= 1199:
    print(5)
elif 1200 <= X <= 1399:
    print(4)
elif 1400 <= X <= 1599:
    print(3)
elif 1600 <= X <= 1799:
    print(2)
elif 1800 <= X <= 1999:
    print(1)

Measured memory_bytes: 9188
n = int(raw_input())
C = [[] for _ in [0]*n]
W = {}
for i in range(n):
  C[i] = map(int, raw_input().split())
  W[(i, i)] = 0
for i in range(1, n):
  for j in range(0, n-i):
    a = j+i
    W[(j, a)] = min([C[j][0] * C[k][1] * C[k+1][0] * C[a][1] + W[(j, k)] + W[(k+1, a)] for k in range(j, j+i)])
print W[0, n-1]

Measured memory_bytes: 4476
def isalpha(c)
    o = c.ord
    return ('a'.ord <= o && o <= 'z'.ord) || ('A'.ord <= o && o <= 'Z'.ord) 
end

cnt = [0] * 26
while gets do
    $_.chars.each do |ch|
        if isalpha(ch)
            cnt[ch.downcase.ord-'a'.ord] += 1
        end
    end
end

cnt.each_with_index {|c, i| puts ('a'.ord+i).chr + " : " + c.to_s }



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

#define dump(x) cout << (x) << endl
#define Int int64_t
#define fi first
#define se second
 
Int INF = 1e18;
Int mod = 1e9+7;
//Int mod = 998244353;

int main() {
     Int n;
    cin >> n;
    vector<vector<pair<Int, Int>>> a(n);
    for (Int i = 0; i < n; i++) {
        Int x;
        cin >> x;
        vector<pair<Int, Int>> v(x);
        for (Int j = 0; j < x; j++) {
            cin >> v[j].fi >> v[j].se;
            v[j].fi--;
        }
        a[i] = v;
    }
    Int res = 0;
    for (Int bit = 0; bit < (1<<n); bit++) {
        bool check = true;
        for (Int i = 0; i < n; i++) {
            for (Int j = 0; j < a[i].size(); j++) {
                if ((bit & (1<<i)) and ((bit & (1<<a[i][j].fi)) != (a[i][j].se<<a[i][j].fi))) {
                    if (check) {
                       // cout << i << " " << bit << endl;
                    }
                    check = false;
                }
            }
        }
        if (check) {
            //dump(bit);
            Int cnt = 0;
            for (Int i = 0; i < n; i++) {
                if (bit & (1<<i)) {
                    cnt++;
                }
            }
            res = max(res, cnt);
        }
    }
    dump(res);
    return 0;
}

Measured memory_bytes: 256
data=[int(input()) for i in range(5)]
import math
ans=0
a,b,c,d,e=data
mod10=[i%10 if i%10!=0 else 10 for i in data]
m = mod10.index(min(mod10))
ans+=data[m]
data[m]=0
for time in data:
    ans+=math.ceil(time/10)*10
print(ans)





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

int main()
{

	int price, change, coin_num, cnt;
	int coin_kind[] = {500, 100, 50, 10, 5, 1};

	while(cin >> price, price > 0) {
		coin_num = 0;
		cnt = 0;
		change = 1000 - price;
		while(change > 0) {
			if(change - coin_kind[cnt] >= 0) {
				coin_num++;
				change -= coin_kind[cnt];
			}
			else {
				cnt++;
			}
		}
		cout << coin_num << endl;
	}

	return 0;

}

Measured memory_bytes: 3056
/*
 * Author:  Teletubbies
 * Created Time:  2012年08月29日 星期三 16&#26102;07分14秒
 * File Name: 1009.cpp
 */
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <time.h>
#include <cctype>
#include <functional>
#include <deque>
#include <iomanip>
#include <bitset>
#include <assert.h>
#include <numeric>
#include <sstream>
#include <utility>

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORD(i,a,b) for (int i=(a); i>=(b); i--)
#define REP(i,b) FOR(i,0,b)
#define sf scanf
#define pf printf
using namespace std;
const int maxint = -1u>>1;
const double pi = 3.14159265358979323;
const double eps = 1e-8;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<int>::iterator vit;

double px,py,vx,vy;
int l[55],r[55],b[55],t[55];
int n,v;

bool check(double vx,double vy,double px){
    double tmpt,yy1,yy2,tt,ppy;
    //cout << vx << " " << vy << endl;
    tt=px/vx;
    ppy=vy*tt-0.5*9.8*tt*tt;
    if (ppy<py) return false;//diguo egg
    for (int i=0; i<n; i++) {
        if (l[i]<px && px<=r[i]) { //muban zhongjian de 
            tmpt=l[i]/vx;
            yy1=vy*tmpt-0.5*9.8*tmpt*tmpt;
            tmpt=px/vx;
            yy2=vy*tmpt-0.5*9.8*tmpt*tmpt; //zhuangqiang de 
            if (yy1>=b[i] && yy1<=t[i]) return false;
            if (yy2>=b[i] && yy2<=t[i]) return false;
            if (yy1<=b[i] && yy2>=b[i]) return false;
            if (yy1>=b[i] && yy2<=b[i]) return false;
            if (yy1>=t[i] && yy1<=t[i]) return false;
            if (yy1<=t[i] && yy2>=t[i]) return false;
        }
        else {
            if (l[i]<px) { //shifou ke feiguo 
                tmpt=l[i]/vx;
                yy1=vy*tmpt-0.5*9.8*tmpt*tmpt;
                tmpt=r[i]/vx;
                yy2=vy*tmpt-0.5*9.8*tmpt*tmpt; //zhuangqiang de 
                if (yy1>=b[i] && yy1<=t[i]) return false;
                if (yy2>=b[i] && yy2<=t[i]) return false;
                if (yy1<=b[i] && yy2>=b[i]) return false;
                if (yy1>=b[i] && yy2<=b[i]) return false;
                if (yy1>=t[i] && yy1<=t[i]) return false;
                if (yy1<=t[i] && yy2>=t[i]) return false;
            }
        }      
        
    }
    return true;
}

int main() 
{
    while (~scanf("%d%d%lf%lf",&n,&v,&px,&py)) {
        for (int i=0; i<n; i++) {
            scanf("%d%d%d%d",&l[i],&b[i],&r[i],&t[i]);
        }    
        bool flag=false;
        for (int i=1; i<=v*1000; i++) {
            vx=i*1.0/1000;
            vy=sqrt(v*v-vx*vx);
            if (check(vx,vy,px)) {
                flag=true;
                puts("Yes");
                break;
            }
        }
        if (!flag) puts("No");
        
    }
    return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1000000000000000;
typedef pair<int, int> P;
ll ma = 1000000000 + 7;
ll h, w, n, m,k; string s; string sp;
char maze[60][60];
int dis[60][60];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main() {
	cin >> n >> s >> k; char key='a';
	for (int i = 0; i < n; i++) {
		if (i == k - 1) {
			key = s[i];
		}
	}
	string res;
	for (int i = 0; i < n; i++) {
		if (s[i] != key) {
			res += '*';
		}
		else {
			res += key;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define R register
#define ll long long
inline int read(){
	R int x; R bool f; R char c;
	for (f=0; (c=getchar())<'0'||c>'9'; f=c=='-');
	for (x=c^'0'; (c=getchar())>='0'&&c<='9'; x=(x<<3)+(x<<1)+(c^'0'));
	return f?-x:x;
}
#define MN 105
int a[MN],cnt[MN],ma,n;bool flag=1;
int main(){
	n=read();
	for (R int i=1; i<=n; ++i) ++cnt[a[i]=read()],a[i]>ma?ma=a[i]:0;
	++ma;if (ma&1){
		if (cnt[ma>>1]!=1) return puts("Impossible"),0;
		for (R int i=ma+1>>1; i<ma; ++i)
			if (cnt[i]<2) return puts("Impossible"),0;
	}else{
		if (cnt[ma>>1]!=2) return puts("Impossible"),0;
		for (R int i=ma>>1; i<ma; ++i)
			if (cnt[i]<2) return puts("Impossible"),0;
	}for (R int i=ma>>1; --i; ) if (cnt[i]) return puts("Impossible"),0;
	puts("Possible");return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double PI=Math.PI;
        double r = sc.nextDouble();
        double s=PI*r*r;
        double R=2*PI*r;
        System.out.printf("%f %f\n",s,R);
        sc.close();
    }
}



Measured memory_bytes: 28352
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

N,M,K = map(int,S().split())
friend = [LI() for i in range(M)]
enemy = [LI() for i in range(K)]

from collections import deque,defaultdict,Counter

G = defaultdict(list)

for a,b in friend:
    G[a].append(b)
    G[b].append(a)

A = [0]*(N+1)  #根

for i in range(1,N+1):
    if A[i] != 0:
        continue
    else:
        A[i] = i
        q = deque([i])
        while q:
            n = q.pop()
            for j in G[n]:
                if A[j] == 0:
                    A[j] = i
                    q.append(j)

c = Counter(A)

A = [[A[i],c[A[i]]] for i in range(N+1)]  #(根,連結成分の大きさ)

#同じ連結成分の中の友達関係、敵対関係の分だけ引く

for a,b in friend:
    if A[a][0] == A[b][0]:
        A[a][1] -= 1
        A[b][1] -= 1
for c,d in enemy:
    if A[c][0] == A[d][0]:
        A[c][1] -= 1
        A[d][1] -= 1

print(*[A[i][1]-1 for i in range(1,N+1)])

#-1は自分自身

Measured memory_bytes: 85292
#include <stdio.h>
#include <stdlib.h>
#define int long long
#define p 998244353

int *fact, *fact_inv, *pow2;

int MOD(int a){
	a %= p;
	return a >= 0 ? a : a + p;
}

int power(int a, int N){
	if(N == 0){
		return 1;
	}
	else if(N % 2 == 0){
		return power(MOD(a * a), N / 2);
	}
	else{
		return MOD(a * power(a, N - 1));
	}
}

int invers(int a){
	return power(a, p - 2);
}

int combination(int N, int k){
	if(k < 0 || N < k){
		return 0;
	}
	else{
		return MOD(fact[N] * MOD(fact_inv[k] * fact_inv[N - k]));
	}
}

int solve1(int K, int N, int s){
	int j, ans = 0;
	for(j = 0; j <= K - s / 2; j++){
		ans = MOD(ans + MOD(combination(K - s / 2, j) * MOD(pow2[j] * combination(N + s - K - 2, N - j))));
	}
	return ans;
}

int solve2(int K, int N, int s){
//	printf("(K, N, s) = (%lld, %lld, %lld)\n", K, N, s);
	int j, ans = 0;
	for(j = 0; j <= s / 2; j++){
//		printf("combination(%lld, %lld) = %lld\n", N + K - s, N - j, combination(N + K - s, N - j));
		ans = MOD(ans + MOD(combination(s / 2, j) * MOD(pow2[j] * combination(N + K - s, N - j))));
//		printf("ans[%lld] = %lld\n", j, ans);
	}
	return ans;
}

signed main(){
	int K, N, i, ans = 0;
	scanf("%lld%lld", &K, &N);
	fact = (int *)malloc(sizeof(int) * (N + K + 1));
	fact_inv = (int *)malloc(sizeof(int) * (N + K + 1));
	pow2 = (int *)malloc(sizeof(int) * (N + K + 1));
	fact[0] = 1;
	fact_inv[0] = 1;
	pow2[0] = 1;
	for(i = 1; i <= N + K; i++){
		fact[i] = MOD(i * fact[i - 1]);
		fact_inv[i] = invers(fact[i]);
		pow2[i] = MOD(2 * pow2[i - 1]);
	}
	for(i = 2; i <= 2 * K; i++){
//		printf("i = %lld\n", i);
		if(i % 2 == 0){
			if(K < i / 2){
				ans = combination(N + K - 1, N);
			}
			else if(K <= i - 1){
//				printf("test2\n");
				ans = MOD(solve1(K - 1, N, i - 1) + solve1(K - 1, N - 1, i - 1));
			}
			else{
//				printf("test3\n");
				ans = MOD(solve2(K - 1, N, i - 1) + solve2(K - 1, N - 1, i - 1));
			}
		}
		else{
			if(K <= i / 2){
				ans = combination(N + K - 1, N);
			}
			else if(K <= i - 1){
				ans = solve1(K, N, i);
			}
			else{
//				printf("test6\n");
				ans = solve2(K, N, i);
			}
		}
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
 
int main () {
  int A, B, M, minA, minB, ans, x, y, c, tmp;
  cin >> A >> B >> M;
  minA = minB = 1000000000;
  int a[A], b[B];
  for (int i = 0; i < A; ++i) {
    cin >> a[i];
    if (minA > a[i]) {
      minA = a[i];
    }
  }
  for (int i = 0; i < B; ++i) {
    cin >> b[i];
    if (minB > b[i]) {
      minB = b[i];
    }
  }
  ans = minA + minB;
  for (int i = 0; i < M; ++i) {
    cin >> x >> y >> c;
    tmp = a[x-1] + b[y-1] - c;
    if (tmp < ans) {
      ans = tmp;
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    
  int64_t n;
  cin >>n;
  vector<char> vec ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  string a=" ";
  while( n >=1){
   int b=  n%26;
    if( b !=0 ){a+= vec.at(b-1);n=n/26;}
    if(b ==0) {a += vec.at(25); n=n/26 -1;}
               
   
    
    
  }
  reverse(a.begin(),a.end());
  cout << a <<endl;
}


Measured memory_bytes: 3580
INF = float('inf')
import copy
 
def dfs(i, C):
    if i == N:
        if min(C[1:]) >= X:
            return C[0]
        else:
            return INF
    res = INF
    res = min(res, dfs(i+1, copy.copy(C)))
    for j in range(M+1):
        C[j] = C[j] + L[i][j]
    res = min(res, dfs(i+1, copy.copy(C)))
    return res

N, M, X = map(int, input().split())
L = [[int(x) for x in input().split()] for _ in range(N)]

ans = dfs(0, [0 for _ in range(M+1)])
if ans == INF:
    ans = -1
print(ans)

Measured memory_bytes: 9280
#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <tuple>
#include <cmath>
#include <iomanip>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 1000000000
#define eps 1e-7
#define mod 1000000007
using namespace std;

int N, M;
int A[1000000+10];
map<int,int> cnt_A;
int B[1000000+10];
map<int,int> cnt_B;

int main(void) {
    cin >> N >> M;
    bool flag=true;
    rep(i, N) {
        cin >> A[i];
        cnt_A[A[i]]++;
        if (cnt_A[A[i]] > 1) flag = false;
    }
    rep(i, M) {
        cin >> B[i];
        cnt_B[B[i]]++;
        if (cnt_B[B[i]] > 1) flag = false;
    }
    
    if (!flag) {
        cout << 0 << endl;
        return 0;
    }
    
    sort(A, A+N);
    reverse(A, A+N);
    sort(B, B+M);
    reverse(B, B+M);
    
    ll ans=1;
    int a_cur=0, b_cur=0;
    for (int i=N*M; i>=1; i--) {
        if (A[a_cur] == i && B[b_cur] == i) {
            ans = ans * 1;
            a_cur++;
            b_cur++;
        } else if (A[a_cur] == i) {
            ans = ans * b_cur;
            ans %= mod;
            a_cur++;
        } else if (B[b_cur] == i) {
            ans = ans * a_cur;
            ans %= mod;
            b_cur++;
        } else {
            ans = ans * (a_cur*b_cur - (N*M - i));
            ans %= mod;
        }
    }
    
    cout << ans << endl;
    
    return 0;
}




Measured memory_bytes: 2432
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <queue>
using namespace std;
int main(void){
    string s;
    cin>>s;
    int ans=0,t_g=0,t_p=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='g'){
            if(t_p<t_g){
                ans++;
                t_p++;
            }
            else{
                t_g++;
            }
        }
        else{
            if(t_p<t_g){
                t_p++;
            }
            else{
                ans--;
                t_g++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int main(void) {
	int a, b;
	scanf("%d%d", &a, &b);
	if (a >= 13)
		printf("%d\n", b);
	else if (a < 13 && a >= 6)
		printf("%d\n", (b / 2));
	else
		printf("0\n");
	return 0;

}

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

int main()
{
	int counter;
	int taroPoint=0, hanakoPoint=0;
	string taroCard, hanakoCard;

	cin>>counter;

	for(int i=0;i<counter;i++){
		cin>>taroCard>>hanakoCard;
		if(taroCard==hanakoCard){
			taroPoint++;
			hanakoPoint++;
			continue;
		}
		int length;
		length = taroCard.length()>hanakoCard.length()?
			hanakoCard.length() : taroCard.length();
		
		for(int j=0;j<length;j++){
			char taro=taroCard.at(j);
			char hanako=hanakoCard.at(j);

			if(taro<hanako){
				taroPoint+=3;
				break;
			}else if(hanako<taro){
				hanakoPoint+=3;
				break;
			}
			if(j==length-1){
				if(taroCard.length()<hanakoCard.length()){
					taroPoint+=3;
				}else{
					hanakoPoint+=3;
				}
			}
		}
		//cout<<taroPoint<<" "<<hanakoPoint<<endl;
		
	}
	cout<<hanakoPoint<<" "<<taroPoint<<endl;

	return 0;
}

		



Measured memory_bytes: 3144
import java.util.*;

@SuppressWarnings("unchecked")
public class Main {
	// public static void printArray(int[] a) {
	// 	for (int i = 0; i < a.length; i++) {
	// 		System.out.print(a[i] + ", ");
	// 	}
	// 	System.out.println();
	// }

	// public static<T> void printArrayT(T[] a) {
	// 	for (int i = 0; i < a.length; i++) {
	// 		System.out.print(a[i] + ", ");
	// 	}
	// 	System.out.println();
	// }

	public static String joinInt(int[] a, String separator) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < a.length; i++) {
			if (i > 0) {
				sb.append(separator);
			}
			sb.append(a[i]);
		}
		return sb.toString();		
	}

	static int[] nextIntArray(Scanner sc, int N) {
		int[] arr = new int[N];
		for (int i = 0; i < N; i++) {
			arr[i] = sc.nextInt();
		}
		return arr;
	}

	public static long gcd(long m, long n) {
		if(m < n) return gcd(n, m);
		if(n == 0) return m;
		return gcd(n, m % n);
	}

	public static boolean[] sieve(int n) {
		boolean[] array = new boolean[n + 2];
		Arrays.fill(array, true);
		array[0] = false;
		array[1] = false;
		for (int i = 2; i*i < array.length; i++) {
			if (!array[i]) continue;
			for (int j = i*i; j < array.length; j += i) {
				array[j] = false;
			}
		}
		return array;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		long gcd = gcd(A, B);
		// System.out.println("gcd =  "+ gcd);
		// int max = (int)Math.sqrt((double)gcd) + 1;
		// boolean[] sieve = sieve(max);
		// int cnt = 1;
		// System.out.println("sqrt =  "+ sqrt);

		int cnt = count(gcd, 1);
		System.out.println(cnt);
	}

	static int count(long gcd, int base) {
		int cnt = 0;
		long i;
		for (i = 2; i * i <= gcd; i++) {
			if (gcd % i == 0) {
				gcd /= i;
				cnt++;
				while (gcd % i == 0) gcd /= i;
			}
		}
		if (cnt == 0) {
			if (gcd > 1) {
				return base + 1;
			}
			return base;
		}
		return count(gcd, cnt + base);
	}
}


Measured memory_bytes: 22100
class UnionFindTree():
    # Union find tree
    # 2つの効率化　経路圧縮、ランク
    # つなげることはできるか分離することはできないので、木をつなげる方向に利用する
    # 
    def __init__(self, node_size):
        # node_num: 全体のノード数
        # parent: ノードがrootなら-1、親がいれば親の番号を入れる
        # size:
        # rank:  
        # self.parent =[-1] * node_size
        self.parent =[-1]*node_size
 
        self.size = [1] * node_size
        self.rank = [1] * node_size
    
    def find_root(self,node):
        # node属する木のrootを探す
        # たどった経路に含まれるnodeの親をrootにつなぎ替える
        if self.parent[node] == -1:             # 自身がrootの場合
            root = node
        else:                                   # 自身がrootでない場合
            root = self.find_root(self.parent[node]) # 再帰的にrootを探す
            self.parent[node] = root            # たどった経路に含まれるnodeの親をrootにつなぎ替える(経路圧縮)
        return root

    def unite(self,node0, node1):
        # node0とnode1が含まれる木を結合する
        
        #node0 node1のrootを求める
        root_node0 = self.find_root(node0) 
        root_node1 = self.find_root(node1)

        if root_node0 != root_node1:
            # rankを比較しrankが小さい方の木を大きい方の木のrootにつなげる
            # rank is sameのときのみrankが増える

            # node1のグループをnode0のグループに結合
            if self.rank[root_node0] == self.rank[root_node1]: # rank is same
                self.parent[root_node1] = root_node0
                self.rank[root_node0] += 1
                self.size[root_node0] += self.size[root_node1]

            # node1のグループをnode0のグループに結合
            elif self.rank[root_node0] > self.rank[root_node1]:
                self.parent[root_node1] = root_node0
                self.size[root_node0] += self.size[root_node1]

            # node0のグループをnode1のグループに結合
            else:
                self.parent[root_node0] = root_node1
                self.size[root_node1] += self.size[root_node0]

    def same(self,node0,node1):
        #同じグループか確かめる
        return self.find_root(node0)==self.find_root(node1)


N,M = map(int,input().split())
p_list = list(map(int,input().split()))

uft = UnionFindTree(N)

for _ in range(M):
    x,y = map(int,input().split())
    x -=1
    y -=1
    uft.unite(x,y)


member_dict = dict()
for i in range(N):
    root = uft.find_root(i)
    p = p_list[i] -1
    if root in member_dict:
        member_dict[root][0].add(i)
        member_dict[root][1].add(p)
    else:
        member_dict[root] = [set([i]),set([p])]

ans = 0
for k in member_dict.keys():
    pos = member_dict[k][0]
    num = member_dict[k][1]
    ans += len(pos&num)
print(ans)

Measured memory_bytes: 75736
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < int(n); ++ (i))
using namespace std;
template <class T> inline void chmax(T & a, T const & b) { a = max(a, b); }
template <typename T> T gcd(T a, T b) { while (a) { b %= a; swap(a, b); } return b; }
 
int main() {
    // input
    int m; scanf("%d", &m);
    assert (m % 2 == 0);
    vector<int> x(m), y(m);
    REP (i, m) scanf("%d%d", &x[i], &y[i]);
    // solve
    map<pair<int, int>, vector<int> > from_angle;
    REP (j, m) REP (i, j) {
        int dy = y[j] - y[i];
        int dx = x[j] - x[i];
        int d = gcd(abs(dy), abs(dx));
        dy /= d;
        dx /= d;
        if (dy < 0) { dy *= -1; dx *= -1; }
        if (dy == 0) dx = 1;
        if (dx == 0) dy = 1;
        from_angle[make_pair(dy, dx)].push_back((1 << i) | (1 << j));
    }
    vector<int> dp(1 << m, -1);
    dp[0] = 0;
    REP (s, 1 << m) if (dp[s] != -1) {
        for (auto pairs : from_angle) {
            vector<int> ts;
            ts.push_back(0);
            for (int dt : pairs.second) {
                if (s & dt) continue;
                for (int i = ts.size(); i --; ) {
                    int t = ts[i] | dt;
                    int k = __builtin_popcount(t) / 2;
                    chmax(dp[s | t], dp[s] + k * (k - 1) / 2);
                    ts.push_back(t);
                }
            }
        }
    }
    // output
    printf("%d\n", dp.back());
    return 0;
}

Measured memory_bytes: 3340
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <queue>
#include <map>
#include <set>
using namespace std;
using Int = int64_t;
const Int INF = 1<<30;
const Int MOD = (Int)1e9 + 7;
const Int MAX_N = (Int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    Int n, k; cin >> n >> k;
    vector<Int> A(n);
    for(int i = 0; i < n; i++) cin >> A[i];

    int j = 0;
    for(int i = k; i < n; i++)
    {
        if(A[j] < A[i])
        {
            cout << "Yes" << "\n";
        }
        else
        {
            cout << "No" << "\n";
        }
        j++;
    }
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 4776