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

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        int sum = a + b + c;
        int max = Math.max(a, Math.max(b, c));
        System.out.println(sum - max);
    }
}


Measured memory_bytes: 21844
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


def count(n):
    return b // n - (a - 1) // n


a, b, c, d = map(int, input().split())
print(b - a + 1 - (count(c) + count(d) - count(lcm(c, d))))


Measured memory_bytes: 38384
import java.util.Scanner;

public class Main {
	private static Scanner sc;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		sc = new Scanner(System.in);
		int A =sc.nextInt();
		int B =sc.nextInt();
		int C =sc.nextInt();
		int D =sc.nextInt();
		int sum1=0,sum2=0;
		sum1=A*B;
		sum2=D*C;
		if(sum1>sum2)System.out.println(sum1);
		else if(sum1<=sum2)System.out.println(sum2);
		
	}

}

Measured memory_bytes: 23892
N = int(input())
AB_list = [list(map(int, input().split())) for i in range(N)]

if len(AB_list) ==1:
    print(1)
    exit(0)

AB_list = sorted(AB_list,key=lambda a:a[0])
kouho_list = []
for i, AB in enumerate(AB_list):
    for j,ab in enumerate(AB_list):
        if i == j:
            continue
        kouho_list.append((ab[0]-AB[0] ,ab[1]-AB[1]))

from collections import Counter
kouho_counter = Counter(kouho_list).most_common()
pq = list(kouho_counter[0][0])

onaji_list = []
#print(kouho_counter)

result = []
for i,ab in enumerate(AB_list):
    for j,ab2 in enumerate(AB_list):
        if i == j:
            continue
        if ab[0] + pq[0] == ab2[0] and ab[1] + pq[1] == ab2[1]:
            result.append(tuple(ab2))
            continue
        #if ab[0] - pq[0] == ab2[0] and ab[1] - pq[1] == ab2[1]:
            #result.append(tuple(ab2))


#print(result)
result = list(set(result))
#print(onaji_list)
#print(result)
print(len(AB_list)-len(result))





'''
候補は49 + 48 + 47 + ...
この候補の中で、一番えらばれているものをp,qとして設定する
その後、ループを回して、実際にコストを計算する

'''


#print(AB_list)


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

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int N, answer,now = 0,next = 1;
            int[] limit = new int[1001];
            limit[0] = 0;
            limit[1] = 1;
            for (int a = 1; a < 1001;a++ )
            {
                if(now>=a)
                {
                    limit[a] = next;
                }
                else
                {
                    now += next;
                    next++;
                    limit[a] = next;
                }
            }
                for (; ; )
                {
                    answer = 0;
                    N = int.Parse(Console.ReadLine());

                    if (N == 0)
                    {
                        break;
                    }

                    for (int a = 2; a < limit[N]; a++)
                    {
                        if (a % 2 == 0)
                        {
                            if (N % a == a / 2)
                            {
                                answer++;
                            }
                        }
                        else
                        {
                            if (N % a == 0)
                            {
                                answer++;
                            }
                        }
                    }
                    Console.WriteLine(answer);
                }

        }
    }
}

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

// 基本テンプレート
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// 型
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// 定数
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion

int main()
{
    int N, K;
    cin >> N >> K;
    P(K*(int)pow(K-1,N-1));

    return 0;
}



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

int main() {
    int n,k;
    cin>>n>>k;
    vector<int> h(n);
    
    rep(i,n){
        cin>>h[i];
    }
    sort(h.begin(),h.end());
    int ans = h[k-1]-h[0];
    for(int i=0;i<n-k;i++){
        ans = min(ans, h[k+i]-h[i+1]);
    }
    
    cout << ans << endl;
    return 0;
}



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

const int mod = 1e9 + 7;

template <typename T> inline bool chmax(T &a, const T &b) {
    if(a >= b) {
        return false;
    }
    a = b;
    return true;
}
template <typename T> inline bool chmin(T &a, const T &b) {
    if(a <= b) {
        return false;
    }
    a = b;
    return true;
}

/*-------------------------------------------*/

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

    char c;
    cin >> c;
    cout << char(c + 1) << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <algorithm>
#include <math.h>

using namespace std;


int main() {
    long long ryuka[87];
    ryuka[0] = 2;
    ryuka[1] = 1;
    for (int i = 2; i < 87; i++) {
	ryuka[i] = ryuka[i - 1] + ryuka[i - 2];
    }
   
    int N; scanf("%d", &N);
    printf("%lld\n", ryuka[N]);

}



Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_macros)]
use itertools::Itertools;
use std::cmp::{max, min};
use std::collections::*;
use std::i64;
use std::io::{stdin, Read};
use std::usize;

trait ChMinMax {
    fn chmin(&mut self, other: Self);
    fn chmax(&mut self, other: Self);
}
impl<T> ChMinMax for T
where
    T: PartialOrd,
{
    fn chmin(&mut self, other: Self) {
        if *self > other {
            *self = other
        }
    }
    fn chmax(&mut self, other: Self) {
        if *self < other {
            *self = other
        }
    }
}

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, $var:ident $($r:tt)*) => {
        let $var = parse_val!($it, usize);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: tt),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, u1) => {
        $it.next().unwrap().parse::<usize>().unwrap() -1
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, x: usize);
    println!("{}", if x == 0 { 1 } else { 0 });
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 2092
# ABC094D - Binomial Coefficients (ARC095D)
def main():
    N = int(input())
    A = tuple(map(int, input().split()))
    n = max(A)
    r = A[0] if A[0] != n else A[1]
    cur = r * (n - r)
    for i in A:
        if i != n:
            x = i * (n - i)
            if x > cur:
                r, cur = i, x
    print(n, r)


if __name__ == "__main__":
    main()

Measured memory_bytes: 14556
#include<cstdio>
using namespace std;
const double eps=1e-10;
struct point{
    double x,y;
    point(double x=0,double y=0):x(x),y(y){}
    point operator +(point a){
        return point(x+a.x,y+a.y);
    }
    point operator -(point a){
        return point(x-a.x,y-a.y);
    }
};
typedef point vector;
point p0,p1;
double dot(vector a,vector b){
    return a.x*b.x+a.y*b.y;
}
double cross(vector a,vector b){
    return a.x*b.y-a.y*b.x;
}
double norm(vector a){
    return a.x*a.x+a.y*a.y;
}
void ccw(point p1,point p2,point p3){
    vector a=p2-p1,b=p3-p1;
    if(cross(a,b)>eps){
        printf("COUNTER_CLOCKWISE\n");
        return;
    }
    if(cross(a,b)<-eps){
        printf("CLOCKWISE\n");
        return;
    }
    if(dot(a,b)<-eps){
        printf("ONLINE_BACK\n");
        return;
    }
    if(norm(a)<norm(b)){
        printf("ONLINE_FRONT\n");
        return;
    }
    printf("ON_SEGMENT\n");
}
int main(){
    int n;
    double x0,y0,x1,y1;
    scanf("%lf%lf%lf%lf",&x0,&y0,&x1,&y1);
    p0=point(x0,y0),p1=point(x1,y1);
    scanf("%d",&n);
    for(int i=1;i<=n;++i){
        scanf("%lf%lf",&x0,&y0);
        ccw(p0,p1,point(x0,y0));
    }
    return 0;
}


Measured memory_bytes: 2752
//░░░
// ░ anzim bin nasir
// ░
#include <stdio.h>
#include <math.h>
 
int main()
{
  double hlen,mlen,hour,minute,rad,len;
  scanf("%lf %lf %lf %lf",&hlen,&mlen,&hour,&minute);
  rad = M_PI * (hour/6 - minute * 11/360);
  len = sqrt(pow(hlen,2) + pow(mlen,2) -2*hlen*mlen*cos(rad));
  printf("%.10f\n",len);
  return 0;
}


Measured memory_bytes: 2608
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <ctime>
using namespace std;
typedef long long ll;

const int INF = 100000000;





int main(int argc, char *args[]) {
	int X, Y, Z, K;
	cin >> X >> Y >> Z >> K;
	vector<ll> A(X), B(Y), C(Z);
	
	for (int i = 0; i < X; i++)cin >> A[i];
	for (int i = 0; i < Y; i++)cin >> B[i];
	for (int i = 0; i < Z; i++)cin >> C[i];

	vector<ll> AB;
	for (int i = 0; i < X; i++) {
		for (int j = 0; j < Y; j++) {
			AB.push_back(A[i] + B[j]);
		}
	}
	sort(AB.begin(), AB.end(), greater<ll>());

	vector<ll> ABC;
	for (int i = 0; i < min(K, (int)AB.size()); i++) {
		for (int j = 0; j < Z; j++) {
			ABC.push_back(AB[i] + C[j]);
		}
	}
	sort(ABC.begin(), ABC.end(), greater<ll>());

	for (int i = 0; i < K; i++) {
		cout << ABC[i] << endl;
	}

}

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

int main()
{
  ll k,x;
  cin >> k >> x;
  for (ll i = -k+1; i < k; i++)
  {
    cout << x+i << " ";
  }
  return 0;
}

Measured memory_bytes: 256
using System;

namespace AtCoder {

    class Program {

        static void Main(string[] args) {

            var tmp = Console.ReadLine().Split(' ');
            var A = int.Parse(tmp[0]);
            var B = int.Parse(tmp[1]);
            var C = int.Parse(tmp[2]);

            if(A > B) {

                var a = B;
                B = A;
                A = a;
            }
            var result = false;
            if(A <= C && B >= C) {

                result = true;
            }
            Console.WriteLine(result ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 13140
for i in range(5):
  x=int(input())
  if x==0:break
  else:
    s=1000-x
    a=s//500
    a1=s-a*500
    b=a1//100
    b1=a1-b*100
    c=b1//50
    c1=b1-c*50
    d=c1//10
    d1=c1-d*10
    e=d1//5
    f=d1-e*5
    sum=a+b+c+d+e+f
  print(sum)


Measured memory_bytes: 5588
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
struct node
{
    int l,r;
} a[100000+20];
bool cmp(node a,node b)
{
    if(a.r==b.r)		return a.l<b.l;
    return a.r<b.r;
}
int main ()
{
    int n,m,i;
    scanf("%d%d",&n,&m);
    for(i=0; i<m; i++)		scanf("%d %d",&a[i].l,&a[i].r);
    int mn=a[0].r;
    for(i=0; i<m; i++)		mn=min(a[i].r,mn);
    sort(a,a+m,cmp);
    int now=mn,h=1;
    for(i=1; i<m; i++)
    {
        if(a[i].l>=now)
        {

            now=a[i].r;
          h++;
        }
    }
    printf("%d\n",h);
    return 0;
}



Measured memory_bytes: 1024
/*
　　　　 ∧＿∧　にっぽんちゃちゃちゃ
　／＼（　・∀・）／ヽ
（ ●　と　　　つ　● ）　にっぽんちゃちゃちゃ
　＼/⊂、 ノ　　＼ノ
　　　　　し'
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define MOD 1000000007
#define INF 9223372036854775807

signed main()
{
  string xyz ="";
int x=0,y=0,z=0,w=0,i=0,j=0,n=0;
while(std::cin >> x>>y){
  z=x*y;
  w=x%y;
  while(w!=0){
    x=y;
    y=w;
    w=x%y;
  }
  std::cout <<y <<" "<<z/y<< '\n';
}

}



Measured memory_bytes: 3152
from collections import deque

H,W = map(int,input().split())
src = [input() for i in range(H)]

dxy = [(1,0),(0,1),(-1,0),(0,-1)]
dists = [[-1]*W for i in range(H)]
dists[0][0] = 0
q = deque([(0,0)])
while q:
    x,y = q.popleft()
    for dx,dy in dxy:
        nx,ny = x+dx,y+dy
        if not 0 <= nx < W: continue
        if not 0 <= ny < H: continue
        if dists[ny][nx] >= 0: continue
        if src[ny][nx] == '#': continue
        q.append((nx,ny))
        dists[ny][nx] = dists[y][x] + 1
d = dists[-1][-1]
if d == -1:
    print(d)
else:
    white = 0
    for row in src:
        for c in row:
            if c == '.':
                white += 1
    print(white - d - 1)

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

int main()
{
  int n, m, c;
  cin >> n >> m >> c;

  vector<int> b(m);

  for(int i = 0; i < m; i++){
    cin >> b[i];
  }

  int cnt = 0;

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

    for(int j = 0; j < m; j++){
      int a;
      cin >> a;

      ans += a*b[j];

    }

    if(ans + c > 0) cnt++;

  }

  cout << cnt << endl;

  return 0;

}


Measured memory_bytes: 256
from collections import deque

n,m = map(int, input().split())
c = [[] for i in range(n)]
d = [-1 for i in range(n)]
d[0] = 0

for i in range(m):
    a,b = map(int, input().split())
    c[a-1].append(b-1)
    c[b-1].append(a-1)

# 部屋 1 をキューに入れる
que = deque([])
que.append(0)

while que:
    # キューの先頭を取り出す
    p = que.popleft()
    # 今いる部屋と繋がっている部屋を順番に探索
    for i in c[p]:
        # すでに訪れたことがあるかの判定
        if d[i] != -1:
            continue
            # 移動できるならキューに入れ、その部屋の道しるべを p で確定する
        que.append(i)
        d[i] = p

print("Yes")
for i in d[1:]:
    print(i+1)


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

#define MAX 100005

using namespace std;

bool dp[MAX];

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, k;
    cin >> n >> k;

    int a[n];
    for(int i = 0; i < n; i++)
        cin >> a[i];
    
    dp[0] = false;
    for(int i = 1; i <= k; i++) {
        dp[i] = false;
        for(int j = 0; j < n; j++) {
            if(i >= a[j] && !dp[i - a[j]]) {
                dp[i] = true;
                break;
            }
        }
    }

    if(dp[k])
        cout << "First" << endl;
    else
        cout << "Second" << endl;
    return 0;
}


Measured memory_bytes: 3720
A, B = map(int, input().split())

# A, B, A+B のいずれかの枚数のクッキーをヤギたちに渡すことができる
# 3匹のヤギ が同じ枚数ずつ食べられるようにクッキーを渡すことが可能ならば 'Possible' と、そうでなければ 'Impossible' と出力

if A % 3 == 0:
    print('Possible')
elif B % 3 == 0:
    print('Possible')
elif (A + B) % 3 == 0:
    print('Possible')
else:
    print('Impossible')

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

int main(){
	for (int i = 1; i <= 9; i++)
	{
		for (size_t j = 1; j <= 9; j++)
		{
			int ans = i * j;
			cout << i << "x" << j << "=" << ans << endl;
		}
	}
    return 0;
}

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

int main() {
  int k, q;
  cin >> k >> q;
  vector<int64_t> d(k), n(q), x(q), m(q);
  for (int i = 0; i < k; i++) cin >> d.at(i);
  for (int i = 0; i < q; i++) cin >> n.at(i) >> x.at(i) >> m.at(i);
  for (int i = 0; i < q; i++) {
    vector<int64_t> dm(k);
    int dm0 = 0;
    for (int j = 0; j < k; j++) {
      dm.at(j) = d.at(j) % m.at(i);
      if (dm.at(j) == 0) dm0++;
    }
    x.at(i) %= m.at(i);
    int64_t s = accumulate(dm.begin(), dm.end(), 0ll),
      sq = s / m.at(i), sr = s % m.at(i), l = (n.at(i) - 1) / k;
    int64_t ans = n.at(i) - 1, r = x.at(i);
    ans -= l * (sq + dm0);
    for (int j = 0; j < (n.at(i) - 1) % k; j++) {
      r += dm.at(j);
      if (dm.at(j) == 0) ans--;
    }
    ans -= (l * sr + r) / m.at(i);
    cout << ans << "\n";
  }
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <cmath>
#include <stdio.h>
#include <sstream>
#define int_inf 1000000000 //1e9
#define ll_inf  1000000000000000000 //1e18
using namespace std;
template <typename T> std::string to_string(const T& t){
	std::ostringstream os; os<<t; return os.str();
}

int main(){
	int n, a;
	cin>>n>>a;
	cout<<n*n-a<<endl;
	return 0;
}




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
	    int a = in.nextInt();
	    int b = in.nextInt();
	    int gsd = 1;
	    if (a>b) {
		    while (a%b !=0)
		    {
		    	int aim = b;
		        b=a%aim;
		        a=aim;
			    gsd=b;
		    }
		    System.out.println(gsd);
	    }
	    else if (a<b) {
	    	while (b%a !=0) {
	    		int aim = a;
	    	    a=b%aim;
	    	    b=aim;
			    gsd=a;
	    	}
	    	System.out.println(gsd);
	    }
	    else {
	    	System.out.println(a);
	    }
	    in.close();
	}
}


Measured memory_bytes: 26328
#include <bits/stdc++.h>
const int maxn = 3;
using namespace std;
char s[maxn];
int main()
{
    cin >> s;
    for (int i = 0; i < strlen(s); i++) {
        if (s[i] == '9') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


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

int main() {
  int k;
  cin>>k;
  if(k==1){
    cout<<"ACL"<<endl;
  }
  else if(k==2){
     cout<<"ACLACL"<<endl;
  }
  else if(k==3){
     cout<<"ACLACLACL"<<endl;
  }
  else if(k==4){
     cout<<"ACLACLACLACL"<<endl;
  }
  else if(k==5){
     cout<<"ACLACLACLACLACL"<<endl;
  }
}


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

int gao(int n,int k){
    if (n%k==0) return n/k;
    int dc=n/k+1, nex=n/k*k+1;
    if (n-nex<dc) return gao(n-dc,k);
    else return gao(n-(n-nex)/dc*dc,k);
}

int main(){
    int T, n, k, ans=0;
    for (cin>>T;T--;){
        cin>>n>>k;
        ans^=gao(n,k);
    }
    puts(ans? "Takahashi": "Aoki");
}

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

typedef long long ll;

int main()
{
    ll n;
    scanf("%lld",&n);
    ll lim = sqrt(n)+1;
    vector<bool> isprime(lim,true);
    ll res = 0;
    for(ll i=2;i<lim;i++) {
        if(isprime[i]) {
            ll cnt = 0;
            ll top = 1;
            while(n%i == 0) {
                n/=i;
                cnt++;
                if(cnt >= top) {
                    cnt -= top;
                    top++;
                    res++;
                }
            }

            for(ll j=i*i;j<lim;j+=i) isprime[j] = false;
        }
    }
    if(n!=1) res++;
    cout << res << endl;
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
int main(){
    int x = 0;
    int	A,B,C;

    cin >> A >> B >> C;

    if(A==B){
        x++;
    }
    if(A==C){
        x++;
    }
    if(B==C){
        x++;
    }
    if(x==1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
const int N=2333;
struct edge{int to,nxt,w,cost;}a[N<<5];
int n,S,T,hd[N],cnt=1,vis[N],pe[N];long long dis[N],ans;
queue<int>Q;
void link(int u,int v,int w,int cost){
	a[++cnt]=(edge){v,hd[u],w,cost};hd[u]=cnt;
	a[++cnt]=(edge){u,hd[v],0,-cost};hd[v]=cnt;
}
bool spfa(){
	memset(dis,-63,sizeof(dis));
	dis[S]=0;Q.push(S);
	while(!Q.empty()){
		int u=Q.front();Q.pop();
		for(int i=hd[u];i;i=a[i].nxt){
			int v=a[i].to;
			if(a[i].w&&dis[v]<dis[u]+a[i].cost){
				dis[v]=dis[u]+a[i].cost;pe[v]=i;
				if(!vis[v])vis[v]=1,Q.push(v);
			}
		}
		vis[u]=0;
	}
	if(dis[T]==dis[0])return false;
	int sum=1<<30;
	for(int i=T;i!=S;i=a[pe[i]^1].to)sum=min(sum,a[pe[i]].w);
	ans+=dis[T]*sum;
	for(int i=T;i!=S;i=a[pe[i]^1].to)a[pe[i]].w-=sum,a[pe[i]^1].w+=sum;
	return true;
}
int main(){
	scanf("%d",&n);S=n+n+1;T=S+1;
	for(int i=1,x,y,z;i<=n;++i){
		scanf("%d%d%d",&x,&y,&z);
		link(S,i,z,0);
		link(i,n+n+3,z,x+y);
		link(i,n+n+4,z,x-y);
		link(i,n+n+5,z,-x+y);
		link(i,n+n+6,z,-x-y);
	}
	for(int i=1,x,y,z;i<=n;++i){
		scanf("%d%d%d",&x,&y,&z);
		link(i+n,T,z,0);
		link(n+n+3,i+n,z,-x-y);
		link(n+n+4,i+n,z,-x+y);
		link(n+n+5,i+n,z,x-y);
		link(n+n+6,i+n,z,x+y);
	}
	while(spfa());
	printf("%lld\n",ans);
	return 0;
}


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

int n,m,i,Ans,X,l;
string s[100],t[100];
int main()
{ 
cin >> n;
for(i=0;i<n;i++){
cin >> s[i];
}
cin >> m;
for(i=0;i<m;i++){
cin >> t[i];
}
Ans=0;
for(i=0; i<n; i++){
X=0;
for(l=0;l<n;l++){
if (s[i]==s[l]){X++;
}
}
for(l=0;l<m;l++){
if (s[i]==t[l]){X--;
}
}
if(X>Ans){Ans=X;
}
}
printf("%d", Ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k, s;
    cin >> n >> k >> s;
    vector<ll> ans;
    for(ll i = 0; i < k; i++) {
        ans.push_back(s);
    }
    if(s == 1) {
        for(ll i = 0; i < n - k; i++) {
            ans.push_back(2);
        }
    } else if(s == 2) {
        for(ll i = 0; i < n - k; i++) {
            ans.push_back(3);
        }
    } else {
        for(ll i = 0; i < n - k; i++) {
            ans.push_back(s - 1);
        }
    }
    for(ll i = 0; i < ans.size(); i++) {
        cout << ans[i] << ' ';
    }
    cout << endl;
}

Measured memory_bytes: 2292
#include <ctime>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>

using namespace std;
typedef long long LL;
const int mod = 998244353;
int _max(int x, int y) {return x > y ? x : y;}
int _min(int x, int y) {return x < y ? x : y;}
int read() {
	int s = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
	return s * f;
}

struct node {
	int x, y;
} a[210];
int bin[210];

int multi(node h1, node h2, node h) {
	int x1 = h1.x - h.x;
	int x2 = h2.x - h.x;
	int y1 = h1.y - h.y;
	int y2 = h2.y - h.y;
	return x1 * y2 - x2 * y1;
}

int main() {
	int n = read();
	bin[0] = 1; for(int i = 1; i <= n; i++) bin[i] = bin[i - 1] * 2 % mod;
	for(int i = 1; i <= n; i++) a[i].x = read(), a[i].y = read();
	int ans = bin[n] - 1;
	for(int i = 1; i <= n; i++) {
		for(int j = i + 1; j <= n; j++) {
			bool bk = 0;
			for(int k = 1; k < j; k++) if(i != k && k != j){
				if(multi(a[i], a[j], a[k]) == 0) {bk = 1; break;}
			} if(bk) continue;
			int u = 2;
			for(int k = j + 1; k <= n; k++) {
				if(multi(a[i], a[j], a[k]) == 0) ++u;
			} (ans -= (bin[u] - u - 1) % mod) %= mod;
		}
	} printf("%d\n", (ans - n + mod) % mod);
	return 0;
}


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

int main()
{
    int n,m,sum=0;
    cin >> n >> m;
    int a[n];
    int cnt=1;
    for(int i=0;i<n;i++){
        cin >> a[i];
        sum+=a[i];
        if(sum<=m){
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
// header {{{
// header {{{
using namespace std;
#include <bits/stdc++.h>
 
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x, y) CPP_CAT_I(x, y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x, y) x##y
 
#define ASSERT(expr...) assert((expr))
 
using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
 
using f32 = float;
using f64 = double;
// }}}
 
constexpr i64 INF = 1'010'000'000'000'000'017LL;
 
constexpr i64 MOD = 1'000'000'007LL;
 
constexpr f64 EPS = 1e-12;
 
constexpr f64 PI = 3.14159265358979323846;
 
#define M5 100007
#define M9 1000000000
 
// util {{{
#define FOR(i, start, end) for (i64 i = (start), CPP_CAT(i, xxxx_end) = (end); i < CPP_CAT(i, xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
 
#define ALL(f, c, ...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ##__VA_ARGS__); })(c))
#define ll long long int
#define VI vector<int>
template <typename C>
i64 SIZE(const C &c)
{
    return static_cast<i64>(c.size());
}
 
template <typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
 
template <typename T, typename U, typename Comp = less<>>
bool chmax(T &xmax, const U &x, Comp comp = {})
{
    if (comp(xmax, x))
    {
        xmax = x;
        return true;
    }
    return false;
}
 
template <typename T, typename U, typename Comp = less<>>
bool chmin(T &xmin, const U &x, Comp comp = {})
{
    if (comp(x, xmin))
    {
        xmin = x;
        return true;
    }
    return false;
}
// }}}
 
// init {{{
struct ProconInit
{
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
 
    ProconInit()
    {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if (AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}
 
//--------------------------------------------------------------------
 
bool isOK(int mid, double key)
{
}
 
int binary_search(double key)
{
    int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int right = 2000000000;
    /* どんな二分探索でもここの書き方を変えずにできる！ */
    while (right - left > 1)
    {
        int mid = left + (right - left) / 2;
 
        if (isOK(mid, key))
            right = mid;
        else
            left = mid;
    }
 
    /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
    return right;
}
 
bool isKaibun(string st)
{
    bool ans = true;
    int n = st.length();
    REP(i, n / 2)
    {
        if (st[i] != st[n - i - 1])
        {
            return false;
        }
    }
    return true;
}
 
int toInt(char a)
{
    return a - '0';
}
 
int gcd(int a, int b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}
 
int lcm(int a, int b)
{
    return a * b / gcd(a, b);
}
 
void solve()
{
    int N, M, K;
    cin >> N >> M >> K;
    int i = N;
    while (i <= K)
    {
        if (i >= M && i <= K)
        {
            cout << "OK";
            return;
        }
        i += N;
    }
    cout << "NG";
}
 
signed main()
{
 
    solve();
 
    return 0;
}

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

int dp[101][4][4][4];

int mod = 1e9+7;

int main(){
	int n;
	cin>>n;
	dp[0][3][3][3] = 1;
	for(int len = 0; len <= n; len++){
		for(int c1 = 0; c1 < 4; c1++){
			for(int c2 = 0; c2 < 4; c2++){
				for(int c3 = 0; c3 < 4; c3++){
					if(dp[len][c1][c2][c3]==0) continue;
					for(int a = 0; a < 4; a++){
						if(a==2 && c1==1 && c2==0) continue;
						if(a==2 && c1==0 && c2==1) continue;
						if(a==1 && c1==2 && c2==0) continue;
						if(a==2 && c1==1 && c3==0) continue;
						if(a==2 && c2==1 && c3==0) continue;

						dp[len+1][a][c1][c2]+=dp[len][c1][c2][c3];
						dp[len+1][a][c1][c2]%=mod;

					}
				}
			}
		}
	}

	int res = 0;
	for(int c1=0;c1<4;c1++){
		for(int c2=0;c2<4;c2++){
			for(int c3=0; c3<4; c3++){
				res+=dp[n][c1][c2][c3];
				res%=mod; 
			}
		}
	}
	cout<<res;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    if(n==1) printf("1\n");
    if(n>=2 && n<4) printf("2\n");
    if(n<8 && n>=4) printf("4\n");
    if(n<16 && n>=8) printf("8\n");
    if(n<32 && n>=16) printf("16\n");
    if(n<64 && n>=32) printf("32\n");
    if(n<128 && n>=64) printf("64\n");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

    int n;cin>>n;
    string s;cin>>s;

    ll dp[n+1][n+1]={};
    rep(j,n){
        dp[1][j]=1;
    }
    vector<ll> sum(n+1,0);
    //dp[i][j]の更新を行う
    for(int i=2;i<=n;i++){
        sum[0]=dp[i-1][0];
        for(int j=1;j<=n;j++) sum[j]=(sum[j-1]+dp[i-1][j])%mod;
        if(s[i-2]=='<'){
            for(int j=0;j<=n-i;j++){
                dp[i][j]=sum[n]-sum[j];
                if(dp[i][j]<0) dp[i][j]+=mod;
            }
        }else{
            for(int j=0;j<=n-i;j++){
                dp[i][j]=sum[j];
            }
        }
    }
    
    cout<<dp[n][0]<<endl;
    return 0;
}


Measured memory_bytes: 70656
import core.stdc.stdio;
import std.traits;
import std.algorithm;
import std.typecons;
import std.stdio;

int[][] wall;
bool[][][] pass;
int[][][][] dist;
int[][][] buf;

int[] dx=[0,-1,0,1];
int[] dy=[-1,0,1,0];

static immutable int inf=114514;
int w,h;

void Clear(T,U)(ref T t,U u){
	static if(isArray!T)
		foreach(ref d;t)
			d.Clear(u);
	else
		t=u;
}

void SetPass(){
	pass.Clear(false);
	foreach(i;0..h)
		foreach(j;0..w){
			if(i>0)
				pass[i][j][0]=wall[i*2-1][j]==0;
			if(j>0)
				pass[i][j][1]=wall[i*2][j-1]==0;
			if(i<h-1)
				pass[i][j][2]=wall[i*2+1][j]==0;
			if(j<w-1)
				pass[i][j][3]=wall[i*2][j]==0;
		}
}

bool inside(int x,int y){
	return 0<=x&&x<w&&0<=y&&y<h;
}

int[] qx,qy,qd;
void BFS(int[][] dst){
	SetPass;
	dst.Clear(inf);
	qx[0]=w-1;
	qy[0]=h-1;
	qd[0]=0;
	dst[h-1][w-1]=0;
	int q=1;
	int i=0;
	while(i<q){
		int x=qx[i],y=qy[i],d=qd[i];
		i++;
		foreach(k;0..4){
			int nx=x+dx[k],ny=y+dy[k];
			if(pass[y][x][k]&&inside(nx,ny)&&dst[ny][nx]==inf){
				qx[q]=nx;
				qy[q]=ny;
				qd[q++]=d+1;
				dst[ny][nx]=d+1;
			}
		}
	}
}

bool Solve(){
	scanf("%d%d",&h,&w);
	if(w==0&&h==0)
		return false;
	foreach(i;0..2*h-1)
		foreach(j;0..w-1+(i&1))
			scanf("%d",&wall[i][j]);
	BFS(dist[0][0]);
	if(dist[0][0][0][0]==inf){
		printf("-1\n");
		return true;
	}
	foreach(i;0..2*h-1)
		foreach(j;0..w-1+(i&1))
			if(wall[i][j]==0){
				wall[i][j]=1;
				BFS(dist[i][j]);
				wall[i][j]=0;
				if(dist[i][j][0][0]==inf){
					printf("-1\n");
					return true;
				}
			}
	SetPass;
	int[][] now=buf[0];
	now.Clear(inf);
	int[][] next=buf[1];
	int ans=inf;
	now[0][0]=0;
	foreach(k;0..h*w){
		next.Clear(inf);
		foreach(i;0..h)
			foreach(j;0..w){
				if(pass[i][j][0])
					next[i][j]=min(next[i][j],max(now[i-1][j],dist[i*2-1][j][i-1][j]+k));
				if(pass[i][j][1])
					next[i][j]=min(next[i][j],max(now[i][j-1],dist[i*2][j-1][i][j-1]+k));
				if(pass[i][j][2])
					next[i][j]=min(next[i][j],max(now[i+1][j],dist[i*2+1][j][i+1][j]+k));
				if(pass[i][j][3])
					next[i][j]=min(next[i][j],max(now[i][j+1],dist[i*2][j][i][j+1]+k));
			}
		swap(now,next);
		ans=min(ans,max(k+1,now[h-1][w-1]));
	}
	printf("%d\n",ans);
	return true;
}

void main(){
	wall=new int[][](60,30);
	pass=new bool[][][](30,30,4);
	dist=new int[][][][](60,30,30,30);
	buf=new int[][][](2,30,30);
	qx=new int[1000];
	qy=new int[1000];
	qd=new int[1000];
	while(Solve){}
}

Measured memory_bytes: 10424
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n);++i)
using namespace std;
using ll = long long; 
using P = pair<int,int>;
using vv = vector<vector<ll> >;
template <class _t> inline bool chmax (_t& a,_t b){if(a<b){a=b;return true;}return false;} template <class _t> inline bool chmin (_t& a,_t b){if(a>b){a=b;return true;}return false;}

const int INF = 2147483647;
const int max_N = 1000000000;
const long long inf = 1ll << 60;
const long long mod = 1000000007;

int dx[4] = {1,0,-1,0};
int dy[4] = {0,-1,0,1};
int main(){
    int n,x,t;cin >> n >> x >> t;
    if(n%x==0) cout << n/x*t << endl;
    else cout << (n/x+1)*t  << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>

int main(void){

    char S[51];
    int N,i,ans = 0;

    scanf("%d",&N);
    scanf("%s",S);

    for(i = 0;i < N-2;i++){
        if(S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C') ans++;
    }

    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define all(A) A.begin(),A.end()
typedef long long ll;

ll llpow(ll a,ll b){
  if (b == 0) return 1;
  return a*llpow(a,b-1);
}

int main(){
  ll n;
  cin >> n;
  int dig = 1;
  while(n>0){
    if(n<=llpow(26,dig)) break;
    n -= llpow(26,dig);
    dig ++;
  }
  //cout << n << "," << dig << endl;
  n--;
  string ans = "";
  rep(i,dig){
    ans += char(n%26+'a');
    n /= 26;
  }
  reverse(all(ans));
  cout << ans << endl;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define rgi register int
#define ll long long
class fastin{
	private: int _ch,_f;
	public: template<typename _Tp> inline fastin& operator>>(_Tp&_x){
		_x=0; while(!isdigit(_ch)) _f|=(_ch==45),_ch=getchar();
		while(isdigit(_ch)) _x=(_x<<1)+(_x<<3)+(_ch^48),_ch=getchar();
		_f&&(_x=-_x,_f=0); return *this;}
	fastin() {_ch=_f=0;}
}fin;
class fastout{
	private: int _num[32],_head;
	public: int SUF; template<typename _Tp> inline fastout& operator<<(_Tp _x){
		_Tp _k; if(_x==0) {putchar('0'),putchar(SUF);return *this;} if(_x<0) putchar('-'),_x=-_x;
		while(_x>0) _k=_x/10,++_head,_num[_head]=(_x-(_k<<1)-(_k<<3))^48,_x=_k;
		while(_head>0) putchar(_num[_head]),--_head; putchar(SUF); return *this;}
	fastout() {_head=0,SUF=' ';}
}fout;
// ----------------------------
// #define int ll
using namespace std;
const int maxn=200004;
const int mod=998244353,inf=1000000007;

ll n,m;
signed main()
{
	fin>>n>>m;
	if(n==1||m==1)
	{
		cout<<1;
		return 0;
	}
	cout<<(n*m+1ll)/2ll;
	return 0;
}
// ----------------------------
// by imzzy


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

int main()
{
    set<int>s;
    int T,num=0;
    cin>>T;
    while(T--)
    {
        int flag,x;
        cin>>flag>>x;
        if(flag==0)
        {
            auto it=s.insert(x);
            if(it.second==1)
                num++;
            cout<<num<<endl;
        }
        else if(flag==1)
        {
            auto it=s.find(x);
            if(it==s.end())
            {
                cout<<0<<endl;
            }
            else cout<<1<<endl;
        }
        else
        {
            int n=s.erase(x);
            num-=n;
        }
    }
  //  cout << "Hello world!" << endl;
    return 0;
}



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

#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define ll long long
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define uset unordered_set
#define endl '\n'
#define umap unordered_map
#define pii pair<int, int> 
#define ld long double
#define pll pair<long long, long long> 

const int N = 2e5 + 15;
int n, m;
string a[N];
map <string, bool> used;

int main() {
	cin >> n;
	for(int i = 1; i <= n; ++i) {
		cin >> a[i];
		if(used[a[i]])
			return cout << "No", 0;
		used[a[i]] = true;
		if(i != 1 && a[i][0] != a[i-1][a[i-1].size()-1])
			return cout << "No", 0;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<cstring>
#include<string>

int h,w;
char G[105][105];

int main()
{
	scanf("%d %d",&h,&w);
	for(int i = 1;i <= h;i++){
		for(int j = 1;j <= w;j++){
			scanf(" %c",&G[i][j]);
		}
	}
	for(int i = 0;i <= h + 1;i++){
		G[i][0] = '#';
		G[i][w + 1] = '#';
	}
	for(int j = 0;j <= w + 1;j++){
		G[0][j] = '#';
		G[h + 1][j] = '#';
	}
	for(int i = 0;i <= h + 1;i++){
		printf("%s\n",G[i]);
	}
	return 0;
}

Measured memory_bytes: 128
n, m = list(map(int, input().split()))
aa = list(map(int, input().split()))

total = sum(aa)
r = (1/(4*m)) * total
c = 0

for i in aa:
    if i >= r:
        c += 1
if c >= m:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3068
import Data.List
import Data.Maybe

main :: IO ()
main = do
    line <- getLine
    -- let line = "AZZ"
    putStrLn $ solve line

solve :: String -> String
solve s = show $ len - indA - indZ'
    where
        len = length s
        indA = fromJust $ elemIndex 'A' s
        indZ' = fromJust $ elemIndex 'Z' $ reverse s


Measured memory_bytes: 16252
#include<iostream>
#include<string>
using namespace std;
int sum=0,a,num;
char s;
int main(){
	cin>>num;
	a=num;
	while(a){
		sum+=a%10;
		a/=10;
	}
	if(num%sum==0){cout<<"Yes"<<endl;return 0;}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
from _bisect import bisect_left
from _bisect import bisect_right

n = int(input())
L = list(map(int, input().split()))
L = sorted(L)

cnt = 0

for a in range(n):
    for b in range(n):
        if a < b:
            c = bisect_left(L, L[a] + L[b], b)
            cnt += c - b - 1
print(cnt)

Measured memory_bytes: 3188
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String s = sc.next();
        String[] sp = s.split("");
        int count = 0;
        int left = 0;
        for(int i=0; i<sp.length; i++) {
            if(sp[i].equals("(")) count++;
            else if(count == 0) left++;
            else count--;
        }
        
        
        String ans = "";
        for(int i=0; i<left; i++) {
            ans += "(";
        }
        ans += s;
        for(int i=0; i<count; i++) {
            ans += ")";
        }
        System.out.println(ans);
     }
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep3(i, n) for (int i = 1; i < (int)(n+1); i++)
#define rep4(i, s, n) for (int i = (s); i < (int)(n+1); i++)
#define repr(i,n) for (int i = (n-1); i>=0;i--)
#define repr3(i,n) for(int i = (n);i>0;i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
#define INF1  100012101;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
 


int main(){
    string S;
    cin>>S;
    if(S.size()<4){
        cout<<"No"<<endl;
        

    }
    else if(S.substr(0,4)=="YAKI"){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
const int infii=1e9+7;
int max_out(int we[],int v[],int n,int w){
    int sum=0;
    rep(i,n) sum+=v[i];
    int dp[n+1][sum+1];
    rep(i,sum+1) dp[0][i]=infii;
    dp[0][0]=0;
    for(int i=1;i<n+1;i++){
        rep(j,sum+1){
            if(j==0) dp[i][j]=0;
            else if(j-v[i-1] >=0) dp[i][j]=min(dp[i-1][j],dp[i-1][j-v[i-1]] + we[i-1]);
            else dp[i][j]=dp[i-1][j];
        }
    }
    int maxs=0;
    rep(i,n+1){
        rep(j,sum+1){
            // cout<<dp[i][j]<<" ";
            if(dp[i][j] <= w) maxs=max(maxs,j);
        }
        // cout<<endl;
    }
    return maxs;
}
int main() {
    int n,w;cin>>n>>w;
    int we[n],v[n];
    for(int i=0;i<n;i++) cin>>we[i]>>v[i];
    cout<<max_out(we,v,n,w);
	return 0;
}

Measured memory_bytes: 43052
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;

//map<string>a
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
//組み合わせ
void recursive_comb(vector<int> indexes, int s, int rest, std::function<void(vector<int>)> f) {
	if (rest == 0) {
		f(indexes);
	}
	else {
		if (s < 0) return;
		recursive_comb(indexes, s - 1, rest, f);
		indexes[rest - 1] = s;
		recursive_comb(indexes, s - 1, rest - 1, f);
	}
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(vector<int>)> f) {
	vector<int>indexes(k);
	recursive_comb(indexes, n - 1, k, f);
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
};
//fixed << setprecision(2)
int main() {
	string s;
	cin >> s;
	map<char,int>m;
	for (int i = 0; i < 4; i++) {
		m[s[i]]++;
	}
	int tmp=0;
	for (auto i : m) {
		if (i.second != 2) {
			cout << "No";
			return 0;
		}

	}
	cout << "Yes";

}
	


Measured memory_bytes: 3596
// Author : Syed Mujtaba
// Seek knowledge from the Cradle to the Grave !!
// https://www.linkedin.com/in/syed-mujtaba

#include <bits/stdc++.h>
using namespace std;
#define int long long
int mod = 1000000007;
int dp[(1LL << 21LL)];
signed main()
{
	int n;
	cin >> n;
	int a[22][22];
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= n; j++)
			cin >> a[i][j];
	dp[0] = 1;
	for(int mask = 0; mask < (1LL << n) - 1; mask++)
	{
		int x = __builtin_popcountll(mask);
		for(int i = 0; i < n; i++)
		{
			if(!(mask & (1LL << i)) && a[x + 1][i + 1] == 1)
			{
				dp[mask | (1LL << i)] = (dp[mask | (1LL << i)]%mod + dp[mask]%mod)%mod;
			}
		}
	}
	cout << dp[(1 << n) - 1] << endl;
}

Measured memory_bytes: 16640
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=10000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 1000000007
#define eps 1e-8
int n,op[200200];
char s[200200];

int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

int main()
{
	n=read();scanf("%s",s+1);
	rep(i,1,n+n)
	{
		if ((i&1)^(s[i]=='B')) op[i]=-1;
		else op[i]=1;
	}
	//rep(i,1,n*2) cout << op[i] << " ";cout << endl;
	int now=0;ll ans=1;
	rep(i,1,n*2)
	{
		if (op[i]==-1)
		{
			if (!now) {puts("0");return 0;}
			ans=ans*now%maxd;
		}
		now+=op[i];
	}
	if (now) {puts("0");return 0;}
	rep(i,1,n) ans=ans*i%maxd;
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define INF 100005

vector<int>adj[INF];
bool vis[INF];
int mem[INF];

int rec(int node)
{
	vis[node]=true;
	int length=1;
	for(auto next:adj[node])
	{
		if(vis[next]==false)
		{
			length=max(length,1+rec(next));
		}else
		{
			length=max(length,1+mem[next]);
		}
	}
	return mem[node]=length;
}

int main()
{
	//freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    int n,m;
    cin >> n >> m;
    for(int i=0;i<m;i++)
    {
    	int aa,bb;
    	cin >> aa >> bb;
    	adj[aa].push_back(bb);
    }
    int maxx=0;
    for(int i=1;i<=n;i++)
    {
    	if(vis[i]==false)
    	{
    		maxx=max(maxx,rec(i));
    	}
    }
    cout << maxx-1 << "\n";
}


Measured memory_bytes: 8192