akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}

int gcd(ll(a), ll(b)) {
	ll c = a;
	while (a % b != 0) {
		c = a % b;
		a = b;
		b = c;
	}
	return b;
}



int main() {
	string S="Positive";
	ll a, b;
	cin >> a >> b;
	if (a <= 0 && b >= 0) {
		S = "Zero";
	}
	else if (a < 0 && b < 0 && (a - b) % 2 == 0) {
		S = "Negative";
	}
		cout<< S<<endl;
	


	
}

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

using namespace std;

typedef long long ll;

int n, i, j;
int w;
ll dp[101][100001];

int main(){
    scanf("%d %d", &n, &w);
    memset(dp, 0, sizeof dp);
    for(i=1;i<=n;++i){
        int a, b;
        scanf("%d %d", &a, &b);
        for(j=0;j<=w;++j)
            dp[i][j]=dp[i-1][j];
        for(j=a;j<=w;++j){
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-a]+b);
        }
    }
    printf("%lld\n", *max_element(dp[n], dp[n]+w+1));
    return 0;
}







Measured memory_bytes: 79104
#include <iostream>
#include <vector>

void solve() {
    int n, k;
    std::cin >> n >> k;
    std::vector<int> xs(n);
    for (auto& x : xs) std::cin >> x;

    for (int i = 0; i + k < n; ++i) {
        std::cout << (xs[i] < xs[i + k] ? "Yes" : "No") << "\n";
    }
}

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

    solve();

    return 0;
}


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

int main(){
    char arr[11000];
    //scanf("%[^\n]", &arr);

    int fr[26];
    for(int i = 0; i < 26; i++){
        fr[i] = 0;
    }

    int k = 0;

    while ( ( scanf("%c", &arr[k])) != EOF ) {
        k++;
    }

    for(int i = 0; i < strlen(arr); i++){
        //if(arr[i] == '.') break;
        if(arr[i] >= 65 && arr[i] <= 91){
            fr[arr[i]-65]++;
        }
        else if(arr[i] >= 97 && arr[i] <= 122){
            fr[arr[i]-97]++;
        }
    }

    for(int i = 0; i < 26; i++){
        printf("%c : %d\n", 97+i, fr[i]);
    }

    return 0;
}


Measured memory_bytes: 2696
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


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


Measured memory_bytes: 256
// AtCoder Beginner Contest 158 C.cpp

#include <iostream>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	for (int i = 12; i < 1010; i++) {
		if (i * 2 / 25 == a && i / 10 == b) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}

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

int main(void){
    while(1){
        int a,b;
        char op;
        cin >> a >> op >> b;
        if(op == '+'){
            cout << (a+b) << endl;
        }
        if(op == '-'){
            cout << (a-b) << endl;
        }
        if(op == '*'){
            cout << (a*b) << endl;
        }
        if(op == '/'){
            cout << (a/b) << endl;
        }
        if(op == '?'){
            break;
        }
    }
}


Measured memory_bytes: 3084
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
         
        while(true){
            int H = sc.nextInt();
            int W = sc.nextInt();
            if(H==0 && W==0){
                break;
            }
            if(1 > H || W > 300){
                continue;
            }
             
            for(int i=0; i<H; i++){
                for(int j=0; j<W; j++){
                    System.out.print('#');
                }
                System.out.println("");
            }
            System.out.println("");
        }
 
    }
 
}


Measured memory_bytes: 36068
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        String s = sc.next();
        long sum = 0;
        for (int i = 0; i < s.length(); i++) sum += s.charAt(i) - '0';
        out.print(sum % 9 == 0 ? "Yes" : "No");
        out.close();
    }


    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }

}

Measured memory_bytes: 36292
/* 未完成 */
#include <iostream>
#include <stdlib.h>
#include <iomanip>
using namespace std;

int main(void){
    int h,w;    

    while (1){
        cin >> h >> w;
        if (h == 0 && w == 0) break;

        for (int i = 0; i < h; ++i)
        {
            for (int j = 0; j < w; ++j)
            {
                if( (i+j) % 2 == 0){ cout << "#";}
                else{cout << ".";}
            }
            cout << endl;
        }
    cout << endl;
    }
    return 0;

}

Measured memory_bytes: 1152
#include <bits/stdc++.h> //g++-9で実行（gcc version 9.3.0），g++だとデフォルトのclang

using namespace std;

//#define int long long                         //intでオーバフローした時の切り替え用
#define OUT(x) std::cout << x << std::endl
#define DEBUG(x) cerr << #x << ": " << x << endl //エラー出力として変数名と変数の中身表示
#define DEBUG_VEC(v)                   \
    cerr << #v << ":";                 \
    for (int i = 0; i < v.size(); i++) \
        cerr << " " << v[i];           \
    cerr << endl;
#define DEBUG_MAT(v)                          \
    cerr << #v << endl;                       \
    for (int i = 0; i < v.size(); i++)        \
    {                                         \
        for (int j = 0; j < v[i].size(); j++) \
        {                                     \
            cerr << v[i][j] << " ";           \
        }                                     \
        cerr << endl;                         \
    }
#define Sp(p) cout << setprecision(25) << fixed << p << endl; //小数点以下を25桁で表示
#define all(obj) (obj).begin(), (obj).end()
#define pb push_back

//usingエイリアス（別名という意味，型定義のこと）
using ll = long long;
//template <class T> using Vec = std::vector<T>;//エイリアステンプレート

const ll MOD = (ll)1e9 + 7;
//const ll MOD = 998244353;あ
const ll INF = (ll)1e18 + 1;
const double EPS = 1e-9;
const long double pi = 3.1415926535897932384626433832795028841971L;

//マクロでintをlong longと定義したときはsinged
int main()
{
    cin.tie(0);                  //cinとcoutの同期を切る（高速化)
    ios::sync_with_stdio(false); //iostreamとstdioの同期を切る（高速化)

    ll n,tmp;
    cin >> n ;
    tmp = 0;
    while(1){
        if (n<=tmp) {OUT(tmp-n); break;} 
        tmp+=1000;
    }
    return 0;
}

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

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

    long long ans = 1LL << 60;
    for (long long i = 0; i <= max(x, y); i++) {
        ans = min(ans, 2 * c * i + max(0LL, x - i) * a + max(0LL, y - i) * b);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#define MOD_TYPE 1

#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using multiInt = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
*/
/*
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
*/
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

inline void init_main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
#pragma endregion

int main()
{
  init_main();

  int n;
  cin >> n;
  ll a[16][16];
  repi(i, n) repi(j, n) cin >> a[i][j];
  ll point[1 << 16] = {};
  repi(msk, 1 << n)
  {
    repi(i, n) REPI(j, i + 1, n)
    {
      if ((msk & (1 << i)) && (msk & (1 << j)))
        point[msk] += a[i][j];
    }
  }

  ll dp[1 << 16];
  fill(dp, dp + (1 << n), -LINF);
  dp[0] = 0;
  REPI(msk, 1, 1 << n)
  {
    for (int msk2 = msk; msk2 > 0; msk2 = (msk2 - 1) & msk)
    {
      ll t = point[msk2] + dp[msk - msk2];
      chmax(dp[msk], t);
    }
  }
  cout << dp[(1 << n) - 1] << "\n";
  return 0;
}


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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  string n; cin >> n;
  int sum = 0;
  rep(i,n.size()){
    int tmp = n[i]-'0';
    sum+=tmp;
  }
  if(sum%9==0) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 3732
#include <iostream>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <string>
#include <memory>
#include <sstream>

#include <limits.h>

using namespace std;

class Hoge
{

public:
  int add(int a, int b)
  {
    return a + b;
  }

  static void ABC117B()
  {
    int n;
    cin >> n;

    int j;
    int max = 0;
    int sum = 0;
    for (int i = 0; i < n; i++)
    {
      cin >> j;
      max = max < j ? j : max;
      sum += j;
    }

    sum = sum - max;
    if (max < sum)
    {
      cout << "Yes";
    }
    else
    {
      cout << "No";
    }

    return;
  }

  static void ABC117C()
  {
    int n, m, t;
    std::vector<int> x;
    cin >> n;
    cin >> m;
    for (int i = 0; i < m; i++)
    {
      cin >> t;
      x.push_back(t);
    }
    std::sort(x.begin(), x.end());

    // cerr << "started n: " << n << ", m: " << m << endl;
    int result = ABC117C_sub(n, m, 0, x);
    cout << result;
    return;
  }

  static int ABC117C_sub(int n, int m, int idx, std::vector<int> &x)
  {
    if (m <= n)
    {
      return 0;
    }
    else
    {
      int minSteps = 1000000;
      for (int i = 0; i < m - 1; i++)
      {
        int stepsLeft = std::abs(x[idx + i] - x[idx]);
        if (stepsLeft >= minSteps)
        {
          break;
        }
        int stepsRight = 0;
        if (n > 1)
        {
          stepsRight = ABC117C_sub(n - 1, m, idx + i + 1, x);
        }
        else
        {
          stepsRight = std::abs(x[m - 1] - x[idx + i]);
        }
        int steps = stepsLeft + stepsRight;
        minSteps = std::min(minSteps, steps);
        //cerr << "n: " << n << ", m: " << m << ", idx: " << idx;
        //cerr << ", minSteps: " << minSteps << ", left:" << stepsLeft << ", right: " << stepsRight << endl;
      }
      return minSteps;
    }
  }
};
int main(int argc, char const *argv[])
{
    Hoge::ABC117B();
    return 0;
}


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

string field[12];

const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

void sol(int x, int y);

int main()
{
  while (cin >> field[0]){
    long ct = 0;
    for (int i = 1; i < 12; i++){
      cin >> field[i];
    }
    for (int i = 0; i < 12; i++){
      for (int j = 0; j < 12; j++){
        if (field[i][j] == '1'){
          field[i][j] = '0';
          sol(i, j);
          ct++;
        }
      }
    }
    cout << ct << endl;
  }
}

void sol(int x, int y)
{
  for (int i = 0; i < 4; i++){
    if (!(0 <= x + dx[i] && 0 <= y + dy[i] && x + dx[i] < 12 && y + dy[i] < 12)) continue;
    if (field[x + dx[i]][y + dy[i]] == '1'){
      field[x + dx[i]][y + dy[i]] = '0';
      sol(x + dx[i], y + dy[i]);
    }
  }
}

Measured memory_bytes: 3072
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<type_traits>
#include<numeric>
#include<limits>
#include<iomanip>
#include<set>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 100000000
#define NUM 1000000007
#define all(x) begin(x), end(x)

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

	VI a(n);
	for (int i = 0; i < n; i++) cin >> a[i];

	sort(all(a));

	ll tate=0, yoko=0;
	int cnt = 0;

	for (int i = n - 1; i > 0; i--) {
		if (a[i] == a[i - 1]) cnt++;
		else cnt = 0;

		if (a[i] == a[i - 1] && tate==0) {
			tate = a[i];
		}else if (a[i] == a[i - 1] && tate != 0 ) {
			yoko = a[i];
			if (tate == a[i] && cnt < 3) {
				yoko = 0;
			}
		}
		if (tate != 0 && yoko != 0) break;
	}

	cout << tate * yoko << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
int read(){
	char c=getchar();while (c!='-'&&(c<'0'||c>'9'))c=getchar();
	int k=1,kk=0;if (c=='-')c=getchar(),k=-1;
	while (c>='0'&&c<='9')kk=kk*10+c-'0',c=getchar();return k*kk;
}using namespace std;
char s[1000],ss[1000]={"AKIHABARA"},d,l;
int main(){
	scanf("%s",s);d=0;l=strlen(s);
	for (int i=0;i<l;i++){
		while (ss[d]!=s[i]&&ss[d]=='A'&&d<=9)d++;
		if (ss[d]!=s[i]){puts("NO");return 0;}d++;
	}if (d>=8)puts("YES");else puts("NO");
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int n,m,l;
    cin>>n>>m>>l;
    int **a,**b,**c;
    a=new int*[n];
    if (a==NULL){
        cout<<"Error!"<<endl;
        return -1;
    }
    int i,j,k;
    for (i=0;i<n;i++){
        a[i]=new int[m];
        if (a[i]==NULL){
            cout<<"Error!"<<endl;
            return -1;
        }
        for (j=0;j<m;j++){
            cin>>a[i][j];
        }
    }
    b=new int*[m];
    if (b==NULL){
        cout<<"Error!"<<endl;
        return -1;
    }
    for (i=0;i<m;i++){
        b[i]=new int[l];
        if (b[i]==NULL){
            cout<<"Error!"<<endl;
            return -1;
        }
        for (j=0;j<l;j++){
            cin>>b[i][j];
        }
    }
    /*
    c=new int*[n];
    if (c==NULL){
        cout<<"Error!"<<endl;
        return -1;
    }
    for (i=0;i<n;i++){
        c[i]=new int[l];
        if (c[i]==NULL){
            cout<<"Error!"<<endl;
            return -1;
        }
        for (j=0;j<l;j++){
            c[i][j]=0;
        }
    }
    */
    for (i=0;i<n;i++){
        for (j=0;j<l;j++){
            long long int c=0;
            for (k=0;k<m;k++){
                c+=a[i][k]*b[k][j];
            }
            cout<<c;
            if (j!=l-1){
                cout<<" ";
            }
        }
        cout<<endl;
    }
    /*
    for (i=0;i<n;i++){
        for (j=0;j<l;j++){
            cout<<c[i][j];
            if (j!=l-1){
                cout<<" ";
            }
        }
        cout<<endl;
    }
    */
    for (i=0;i<n;i++){
        delete[] a[i];
    }
    delete[] a;
    for (i=0;i<m;i++){
        delete[] b[i];
    }
    delete[] b;
    /*
    for (i=0;i<n;i++){
        delete[] c[i];
    }
    delete[] c;
    */
    return 0;
}

Measured memory_bytes: 1272
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
ll a,b;
int main(){
	cin>>a>>b;
	if(a>0 && b>0) cout<<"Positive\n";
	else if(a==0 || b==0) cout<<"Zero\n";
	else{
		if(b<0){
			cout<<((b-a)&1?"Positive\n":"Negative\n");
		}else if(a<0){
			cout<<"Zero\n";
		}
	}
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int counter;

void search( int n, int s, int csum, int begin, int depth ){
  for( int i = begin; i <= 9; i++ ){
    if( depth == n && csum + i == s  ){
      counter++;
    }
    if( csum >= s ){ return; }
    search( n, s, csum + i, i + 1, depth + 1 );
  }
}

int main(){
  int n, s;
  while( 1 ){
    counter = 0;
    cin >> n >> s;
    if( !n && !s ){ return 0; }
    search( n, s, 0, 0, 1 );
    cout << counter << endl;
  }
}

Measured memory_bytes: 0
def f_e():
    n = int(input())
    a = [list(map(lambda x: int(x)-1, input().split()))[::-1] for _ in range(n)]
    q, bench, days = list(range(n)), [-1]*n, [0]*n
    while q:
        i = q.pop(0)
        if not a[i]:
            continue
        you = a[i].pop()
        if bench[you] == i:
            days[i] = days[you] = max(days[i], days[you])+1
            bench[i] = bench[you] = -1
            q.append(i); q.append(you)
        else:
            bench[i] = you
    o = -1 if max(bench)>=0 else max(days)
    print(o)

if __name__ == "__main__":
    f_e()


Measured memory_bytes: 34676
#include <iostream>

using namespace std;

typedef long long ll;

int main () {
	ll a,b,c,d;
	ll i = 0;
	ll ret;
	
    cin >> a>>b>>c>>d;
    
    while ((a > 0) &&(c>0) ) {
        if ( i % 2 == 0 ) {
            c -= b;
        }
        else {
            a -= d;
        }
        i++;
    }
    
    if ( i % 2 == 0 ) {
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }
    
	return 0;
}

Measured memory_bytes: 3636
S = input()
N = len(S)
for i in range(N-1):
    if S[i] == S[i + 1]:
        print(i+1,i+2)
        exit()
for i in range(N-2):
    if S[i] == S[i + 2]:
        print(i + 1 ,i + 3)
        exit()
        
print(-1,-1)

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

int main() {
    int n, c, t;
    auto ret = 100000000000ll;
    std::cin >> n >> c;
    std::vector<std::vector<long long>> d(c, std::vector<long long>(c));
    std::vector<std::map<int, int>> s(3);
    for (auto i = 0; i < c; i++) {
        for (auto j = 0; j < c; j++) {
            std::cin >> d[i][j];
        }
    }
    for (auto i = 0; i < n; i++) {
        for (auto j = 0; j < n; j++) {
            std::cin >> t;
            t--;
            s[(i + j) % 3][t]++;
        }
    }
    std::vector<long long> c0(c), c1(c), c2(c);
    for (int i = 0; i < c; i++) {
        for (auto& f : s[0]) c0[i] += f.second * d[f.first][i];
        for (auto& f : s[1]) c1[i] += f.second * d[f.first][i];
        for (auto& f : s[2]) c2[i] += f.second * d[f.first][i];
    }
    for (int fst = 0; fst < c; fst++) {
        for (int snd = 0; snd < c; snd++) {
            if (snd == fst) continue;
            for (int thd = 0; thd < c; thd++) {
                if (thd == fst || thd == snd) continue;
                auto rr = c0[fst] + c1[snd] + c2[thd];
                ret = std::min(ret, rr);
            }
        }
    }
    std::cout << ret << std::endl;

    return 0;
}

Measured memory_bytes: 256
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]

def is_bingo(A, B):
    if A[0][0] in B and A[0][1] in B and A[0][2] in B:
        return True
    if A[1][0] in B and A[1][1] in B and A[1][2] in B:
        return True
    if A[2][0] in B and A[2][1] in B and A[2][2] in B:
        return True

    if A[0][0] in B and A[1][0] in B and A[2][0] in B:
        return True
    if A[0][1] in B and A[1][1] in B and A[2][1] in B:
        return True
    if A[0][2] in B and A[1][2] in B and A[2][2] in B:
        return True

    if A[0][0] in B and A[1][1] in B and A[2][2] in B:
        return True
    if A[0][2] in B and A[1][1] in B and A[2][0] in B:
        return True

    return False

print('Yes' if is_bingo(A, B) else 'No')


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

int main(){
	char buf[100];
	int len;

	scanf("%s", buf);
	len = strlen(buf);

	for(int i = 0; i < (len - 1) / 2; i++){
		if(buf[i] != buf[len - 1 - i]){
			printf("No\n");
			return 0;
		}
	}

	for(int i = 0; i < (len - 1) / 4; i++){
		if(buf[i] != buf[(len - 1) / 2 - 1 - i] || 
			buf[(len + 3) / 2 - 1 + i] != buf[len - 1 - i]){
			printf("No\n");
			return 0;
		}
	}

	printf("Yes\n");	
}


Measured memory_bytes: 128
// https://atcoder.jp/contests/abc176/tasks/abc176_e

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "string"
#include "unordered_set"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
using ll = long long;
using ld = long double;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
template <typename T>
using VV = V<V<T>>;
using VVL = VV<ll>;
template <typename T>
using VVV = VV<V<T>>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
using asc_pq = priority_queue<T, V<T>, greater<T>>;

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

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

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  ll H, W, M;
  cin >> H >> W >> M;

  VPL bs(M);
  map<int, unordered_set<int>> wh, hw;

  rep(i, M) {
    ll h, w;
    cin >> h >> w;
    h--, w--;
    bs[i].fi = h;
    bs[i].se = w;

    wh[w].insert(h);
    hw[h].insert(w);
  }

  VL h_ct(H);
  VL w_ct(W);

  rep(i, M) {
    auto [h, w] = bs[i];
    w_ct[w]++;
    h_ct[h]++;
  }

  ll w_ct_max = 0;
  ll h_ct_max = 0;

  rep(h, H) chmax(h_ct_max, h_ct[h]);
  rep(w, W) chmax(w_ct_max, w_ct[w]);

  VL hs;
  VL ws;

  rep(h, H) if (h_ct[h] == h_ct_max) hs.push_back(h);
  rep(w, W) if (w_ct[w] == w_ct_max) ws.push_back(w);

  ll res = w_ct_max + h_ct_max;

  // 爆弾の個数は M 個。組み合わせが M+1 以上の場合、 M+1 個の組を見終える前に
  // drop されるため O(M)
  for (ll h : hs) {
    for (ll w : ws) {
      if (hw[h].count(w) == 0) drop(res);
    }
  }

  res--;
  cout << res << "\n";
}


Measured memory_bytes: 124088
#include <iostream>

using namespace std;
 
int main(){
    int CD,Buyer;
    int cnt100,cnt500,cnt1000;
    int change;
 
    while(1){
	cnt100 = cnt500 = cnt1000 = 0;
	change = 0;
 
	cin >> CD >> Buyer;
	if( CD == 0 && Buyer == 0 ) break;
 
	change = Buyer - CD;
	while( change != 0 ){
	    if( change >= 1000 ){
		change -= 1000;
		cnt1000++;
	    }
	    else if( change >= 500 && change < 1000 ){
		change -= 500;
		cnt500++;
	    }
	    else if( change >= 100 && change < 500 ){
		change -= 100;
		cnt100++;
	    }
	}
	cout << cnt100 <<" "<< cnt500 <<" "<< cnt1000 << endl;
    }
    return 0;
}

Measured memory_bytes: 3088
#include <stdio.h>

void swap(int *a, int *b);

int main(){
	int i,n,A[100],counter=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}

	int flag=1;
	while(flag){
		flag=0;
		for(i=n-1;i>=1;i--){
			if(A[i]<A[i-1]){
				swap(&A[i],&A[i-1]);
				flag=1;
				counter++;
			}
		}
	}

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

	return 0;
}

void swap(int *a, int *b){
	int c;
	c=*a;
	*a=*b;
	*b=c;
}

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

typedef long long ll;

ll K, A[100005], l, r;
ll mn, mx;

int main() {
	cin >> K;
	for (int i = 0; i < K; ++i) {
		cin >> A[i];
	}

	l = 0, r = 1e18;
	while (l < r) {
		ll m = (l + r) / 2;
		ll v = m;
		for (int i = 0; i < K; ++i) v = (v / A[i]) * A[i];
		if (v < 2) l = m + 1;
		else r = m;
	}

	mn = l;

	l = 0, r = 1e18;
	while (l < r) {
		ll m = (l + r) / 2;
		ll v = m;
		for (int i = 0; i < K; ++i) v = (v / A[i]) * A[i];
		if (v <= 2) l = m + 1;
		else r = m;
	}

	mx = l - 1;

	if (mn <= mx) cout << mn << " " << mx << endl;
	else cout << -1 << endl;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main() {
	long long n,k,a[200005],b[200005]={};
	int now=1,j=1;
	cin>>n>>k;
	for (int i=1; i<=n; i++) cin>>a[i];
	int c=0;
	for (long long i=k; i>0; i--) {
		b[now]=j;
		if (b[a[now]]!=0 && c==0) {
			i %= (b[now]-b[a[now]]+1);
          	c=1;
		}
      	if (i!=0) now=a[now];
		j++;
	}
	cout << now << endl;
	return 0;
}

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

int main(){
  int a;
  cin>>a;
  if(a%2==0){
    cout<<a*a/4;
  }else{
    cout<<((a-1)/2+1)*(a/2);
  }
  return 0;
}
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  char a, b; cin >> a >> b;
  cout << ((a == 'H' && b == 'H') || (a == 'D' && b == 'D') ? "H" : "D") << endl;
}


Measured memory_bytes: 256
fun main(arr:Array<String>) {
    println(if(isValid(readLine()!!)) "AC" else "WA")
}

fun isValid(s:String):Boolean {
    if(!s.startsWith("A")) {
        return false
    }
    val tmp = s.substring(2, s.length-1)
    if(tmp.count{it == 'C'} != 1) {
        return false
    }
    return s.filter { it >= 'a' && it <= 'z' }.count() == s.length - 2
}

Measured memory_bytes: 33784
H,W = map(int,input().split())
a =[list(map(int,input().split())) for i in range(H)]


serching_pair = False
pair_count = 0
ans = []
#蛇行運転しながら奇数ペアを見つけるたびに出力
for i in range(H):
    if i%2 == 0:#左から右
        for j in range(0,W,1):
            if a[i][j]%2==1:
                if serching_pair:
                    ans[pair_count].append([i+1,j+1])
                    pair_count+=1
                    serching_pair=False
                else:
                    ans.append([[i+1,j+1]])
                    serching_pair=True
            else:
                if serching_pair:
                    ans[pair_count].append([i+1,j+1])

    else:#右から左
        for j in range(W-1,-1,-1):
            if a[i][j]%2==1:
                if serching_pair:
                    ans[pair_count].append([i+1,j+1])
                    pair_count+=1
                    serching_pair=False
                else:
                    ans.append([[i+1,j+1]])
                    serching_pair=True
            else:
                if serching_pair:
                    ans[pair_count].append([i+1,j+1])

ans_size=0
for i in range(0,pair_count,1):
    ans_size+=len(ans[i])-1
print(ans_size)

for i in range(0,pair_count,1):
    for j in range(1,len(ans[i])):
        print(" ".join(list(map(str,ans[i][j-1]+ans[i][j]))))




Measured memory_bytes: 113936
#include "bits/stdc++.h"
using namespace std;

int main() {
	int K, S;
	cin >> K >> S;
	int ans = 0;
	for (int i = 0;i<=K;++i) {
		for (int j = 0;j<=K;++j) {
			int k = S - i - j;
			if ((0<=k)&&(K>=k)) {
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
  char c[3][3];
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin >> c[i][j];
    }
  }
  cout << c[0][0] << c[1][1] << c[2][2] << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main (void) {
    int time_by_sec;
    scanf("%d", &time_by_sec);

    int hour, minute;

    hour = time_by_sec / 3600;
    time_by_sec = time_by_sec % 3600;

    minute = time_by_sec / 60;
    time_by_sec = time_by_sec % 60;

    printf("%d:%d:%d\n", hour, minute, time_by_sec);
    return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
/*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
int main(){
   ll n,k;
   cin >> n >> k;
   vector<ll>a(n+1);
   for(int i=0;i<=n;i++){
      a.at(i)=i;
   }
   vector<ll>b(n+2);
   for(int i=1;i<=n+1;i++){
      b.at(i)+=a.at(i-1)+b.at(i-1);
   }
   ll ans = 0;
   for(int i=k;i<=n+1;i++){
      ll l  =b.at(i);
      ll r= b.at(n+1)-b.at(n+1-i);
      ll che = r-l +1;
      ans+=che;
      ans%=mod;
   }
   cout << ans << endl;
}
    



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

namespace c
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var h = Console.ReadLine().Split().Select(k => int.Parse(k)).ToList();

            var i = 0;
            var maxVal = 0;
            while(i < n){
                var move = 0;
                while(i < n - 1 && h[i] >= h[i+1]){
                    i++;
                    move++;
                }
                maxVal = Math.Max(maxVal, move);
                i++;
            }

            Console.WriteLine(maxVal);
        }
    }
}


Measured memory_bytes: 29788
#include<stdio.h>

int main() {

	char c[102];
	char s[102];
	int i,j;
	int unbalance;

	for(;;) {
		gets(c);
		if(c[0]=='.') break;

		j=0,unbalance=0;;
		for(i=0;i<102;i++) {
			if(c[i]=='.') break;

			switch (c[i]) {

			case '(':
			case '[':
				s[j]=c[i];
				j++;
				break;

			case ')':
				if(j>0&&s[j-1]=='(') {
					s[j-1]='\0';
					j--;
				}
				else unbalance=1;
				break;

			case']':
				if(j>0&&s[j-1]=='[') {
					s[j-1]='\0';
					j--;
				}
				else unbalance=1;
				break;
			}
			if(unbalance) break;
		}
		if(j>0||unbalance)
			printf("no\n");
		else
			printf("yes\n");
	}
	return 0;
}

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


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] tmpArray = br.readLine().split(" ");
		
		int n = Integer.parseInt(tmpArray[0]);
		int K = Integer.parseInt(tmpArray[1]);
		
		Point[] points = new Point[n];
		long x[] = new long[n];
		long y[] = new long[n];
		
		for(int i = 0; i < n; i++){
			tmpArray = br.readLine().split(" ");
			points[i] = new Point(Long.parseLong(tmpArray[0]), Long.parseLong(tmpArray[1]));
			x[i] = Long.parseLong(tmpArray[0]);
			y[i] = Long.parseLong(tmpArray[1]);
		}	
		
//		Arrays.sort(points);
		Arrays.sort(x);
		Arrays.sort(y);
		
		//長方形を探索
		long minArea = Long.MAX_VALUE;
//		for(int i = 0; i + k - 1< n ; i++){
//			System.out.println("range "+i+" to "+(i + k - 1));
//			long tmpArea = (points[i + k - 1].x - points[i].x)*
//					(maxY(points, i, i + k - 1) - minY(points, i, i + k - 1));
////			System.out.println("dx "+(points[i + k - 1].x - points[i].x));
//			System.out.println("i = " + i + " area "+ tmpArea);
//			if(tmpArea < minArea){
//				minArea = tmpArea;
//			}
//		}
		
		//ガチの全探索
		for(int i = 0; i < n - 1; i++){
			for(int j = i + 1; j < n; j++){
				for(int k = 0; k < n - 1; k++){
					for(int l = 0; l < n; l++){
						long left = x[i];
						long right = x[j];
						long bottom = y[k];
						long top = y[l];
						
						int count = pointInRect(left, right, top, bottom, points);
//						System.out.println(count);
						if(count >= K){
							long tmpArea = (right - left)*(top - bottom);
							
							if(tmpArea < minArea){
								minArea = tmpArea;
							}
						}
					}
				}
			}
		}
		
		System.out.println(minArea);
	}
	
	static int pointInRect(long left, long right, long top, long bottom, Point[] points){
		int result = 0;
		
//		System.out.println(left+" "+right+" "+top+" "+bottom);
		
		for(int i = 0; i < points.length ; i++){
			if(points[i].x >= left && points[i].x <= right
					&& points[i].y >= bottom && points[i].y <= top ){
				result++;
			}
		}
		
		return result;
	}

	static long minY(Point[] points, int start, int end){
		long min = points[start].y;

		for(int i = start + 1; i <= end; i++){
			if(min > points[i].y){
				min = points[i].y;
			}
		}
		
		return min;
	}
	
	static long maxY(Point[] points, int start, int end){
		long max = points[start].y;

		for(int i = start + 1; i <= end; i++){
			if(max < points[i].y){
				max = points[i].y;
			}
		}
		
		return max;
	}

}

class Point implements Comparable<Point>{

	long x;
	long y;
	
	public Point(long x, long y){
		this.x = x;
		this.y = y;
	}
	
	public int compareTo(Point p) {
		// TODO Auto-generated method stub
		if(this.x > p.x){
			return 1;
		}
		else if(this.x == p.x){
			return 0;
		}
		else {
			return -1;
		}
	}
	
}

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

int main() {
  int N = 0;
  int C = 0;
  int S[1000];
  int E[1000];

  cin >> N;
  if (1 <= N <= 1000 ){
    for (int i = 0; i < N; i++) {
      cin >> S[i] >> E[i];
      for (int j = S[i] - 1;  j < E[i]; j++) {
        C++;
      }
    }
  }
  cout << C << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll INF=1e18;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n,Q;
    cin>>n>>Q;
    string s;
    cin>>s;
    s.insert(0,"x");
    s+='x';
    V<char> t(Q),d(Q);
    rep(i,Q) cin>>t[i]>>d[i];
    int rans=0;
    int left=0,right=n+1;
    while(right-left>1){
        int mid=(right+left)/2;
        bool ok=0;
        int k=mid;
        rep(i,Q){
            if(s[k]==t[i]){
                if(d[i]=='L') k--;
                else k++;
                if(k==0){
                    ok=1;
                    break;
                }
            }
        }
        if(ok) left=mid;
        else right=mid;
    }
    rans+=left;
    left=0,right=n+1;
    while(right-left>1){
        int mid=(right+left)/2;
        bool ok=0;
        int k=mid;
        rep(i,Q){
            if(s[k]==t[i]){
                if(d[i]=='L') k--;
                else k++;
                if(k==n+1){
                    ok=1;
                    break;
                }
            }
        }
        if(ok) right=mid;
        else left=mid;
    }
    rans+=n-right;
    cout<<n-rans-1<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
(全探索できるなら全探索しろ)
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'\n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え(=でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
*/

Measured memory_bytes: 976
#include<bits/stdc++.h>
using namespace std;
const long long maxn=1e5+5;
const long long inf=0x3f3f3f3f;
const long long mod=1e9+7;
long long quick_pow(long long a,long long b)
{
	return b?quick_pow(a*a%mod,b/2)*(b%2?a:1)%mod:1;
}
long long k;
string s;
long long fac[2<<20],inv[2<<20];
long long comb(long long x,long long y)
{
	return fac[x]*inv[y]%mod*inv[x-y]%mod;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	long long k;
	cin>>k>>s;
	long long t=k+s.size();
	fac[0]=1;
	for(long long i=1;i<=t;i++)
		fac[i]=fac[i-1]*i%mod;
	inv[t]=quick_pow(fac[t],mod-2);
	for(long long i=t;i--;)
		inv[i]=inv[i+1]*(i+1)%mod;
	long long ans=0;
	for(long long i=s.size();i<=k+s.size();i++)
		ans+=comb(t,i)*quick_pow(25,t-i)%mod;
	cout<<ans%mod<<endl;
	return 0;
}

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

using namespace std;

int mat[10] = {0,2,5,5,4,5,6,3,7,6};

bool cmp(int i, int j) {
	return mat[i] < mat[j] || mat[i] == mat[j] && i > j;
}

void dfs(int rem, vector<int>& num, vector<int>& tmp, vector<int>& ans) {
	if (rem == 0) {
		if (tmp.size() > ans.size()) {
			ans = tmp;
			// for (int i = 0; i < ans.size(); i++) {
			// 	printf("%d", ans[i]);
			// }
			// printf("\n");
		} else
		if (tmp.size() == ans.size()) {
			for (int i = 0; i < tmp.size() && tmp[i] >= ans[i]; i++) {
				if (tmp[i] > ans[i]) {
					ans = tmp;
					// for (int i = 0; i < ans.size(); i++) {
					// 	printf("%d", ans[i]);
					// }
					// printf("\n");
					break;
				}
			}
		}
		return;
	}
	// cout << rem << ": ";
	// for (int i = 0; i < tmp.size(); i++) {
	// 	printf("%d", tmp[i]);
	// }
	// printf("\n");
	for (int i = 0; i < num.size(); i++) {
		if (mat[num[i]] > rem) {
			continue;
		}
		tmp.push_back(num[i]);
		dfs(rem - mat[num[i]], num, tmp, ans);
		tmp.pop_back();
	}
}

int main() {
	int n, m, x;
	scanf("%d %d", &n, &m);
	vector<int> num;
	for (int i = 0; i < m; i++) {
		scanf("%d", &x);
		num.push_back(x);
	}
	sort(num.begin(), num.end(), cmp);
	int mul = 0, sam = 0;
	if (n > 30) {
		mul = (n - 30) / mat[num[0]];
		n -= mul * mat[num[0]];
		sam = num[0];
	}
	// cout << mul << endl;
	// cout << sam << endl;
	sort(num.begin(), num.end(), greater<int>());
	vector<int> ans, tmp;
	dfs(n, num, tmp, ans);
	for (int i = 0; i < ans.size(); i++) {
		if (mul > 0 && sam >= ans[i]) {
			while (mul--) {
				printf("%d", sam);
			}
		}
		printf("%d", ans[i]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a = input()

if "a" <= a <= "z":
    print("a")
else:
    print("A")


Measured memory_bytes: 9988
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] s = scanner.next().toCharArray();

			boolean flgKisuu = true;
			for (int i = 0; i < s.length; i+=2) {
				// 以下に該当したらNo!
				if (s[i] == 'L') {
					flgKisuu = false;
					break;
				}
			}
			boolean flgGuusu = true;
			for (int i = 1; i < s.length; i+=2) {
				// 以下に該当したらNo!
				if (s[i] == 'R') {
					flgGuusu = false;
					break;
				}
			}
			if (flgGuusu && flgKisuu) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
		}
	}
}


Measured memory_bytes: 23124
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (a, b) = (v[0], v[1]);
    let s = read::<String>().chars().collect::<Vec<_>>();

    if s.len() != a + b + 1 {
        println!("No");
        return;
    }

    for i in 0..a + b + 1 {
        if i == a {
            if s[i] == '-' {
                continue;
            }
        } else if let Some(_) = s[i].to_digit(10) {
            continue;
        }
        println!("No");
        return;
    }
    println!("Yes");
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
package main

import "fmt"

func main() {
  var s string
  fmt.Scan(&s)
  charge := 700
  
  if s[0] == 'o' {charge += 100}
  if s[1] == 'o' {charge += 100}
  if s[2] == 'o' {charge += 100}
  fmt.Println(charge)
}

Measured memory_bytes: 512
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int q;
	cin>>q;
	int t,f;
	char c;
	string front,end;
	front.clear();
	end.clear();
	int re_num=0;
	for(int i=0;i<q;i++){
		cin>>t;
		if(t==1){
			re_num++;
		}else if(t==2){
			cin>>f;
			cin>>c;
			if(f==1){
				if(re_num%2==0){
					front.push_back(c);
				}else{
					end.push_back(c);
				}
			}else{
				if(re_num%2==0){
					end.push_back(c);
				}else{
					front.push_back(c);
				}
			}
		}
	}
	if(re_num%2!=0){
		reverse(end.begin(), end.end());
	}else{
		reverse(front.begin(), front.end());
	}
	string ans;
	if(re_num%2!=0){
		reverse(s.begin(), s.end());
		ans = end + s + front;
	}else{
		ans = front + s + end;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1348
#include <iostream>
#include <cstring>

using namespace std;

int n, ans, z[5005];
string s;

void zalgo(string cmp)
{
	memset(z, 0, sizeof(z));
	int l = 0, r = 0;
	for (int i = 1; i < cmp.length(); i++)
	{
		if (i > r)
		{
			int now = i;
			while (cmp[now] == cmp[now - i]) now++;
			now--;
			if (now >= i)
			{
				r = now;
				l = i;
				z[i] = now - i + 1;
			}
		}
		else
		{
			int k = i - l;
			if (z[k] >= r - i + 1)
			{
				int now = r;
				while (cmp[now] == cmp[now - i]) now++;
				now--;
				l = i, r = now;
				z[i] = r - l + 1;
			}
			else z[i] = z[k];
		}
	}
}

int main()
{
    cin >> n >> s;
    for (int i = 0; i < n - 1; i++)
    {
        zalgo(s.substr(i));
        for (int j = i + 1; j < n; j++)
            ans = max(ans, min(j - i, z[j - i]));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
s = input().split() #s_1 s_2を分割して取得し、sに値を入れる
five = 0
seven = 0
for i in range(3):
    if s[i] == '5':
        five += 1
    if s[i] == '7':
        seven += 1
        
if five == 2 and seven == 1:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 5000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(){
    int N, K; cin >> N >> K;
    vector<ll> x(N), y(N);
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i];
    }

    vector<ll> X, Y;
    for (int i = 0; i < N; i++) {
        X.push_back(x[i]);
        Y.push_back(y[i]);
    }
    sort(ALL(X));
    sort(ALL(Y));
    X.erase(unique(ALL(X)), X.end());
    Y.erase(unique(ALL(Y)), Y.end());

    int L = X.size();
    int M = Y.size();
    ll ans = INF;
    int k, l, cnt;
    for (int i = 0; i < L; i++) {
        for (int j = 0; j < L; j++) {
            if(i == j) continue;
            k = 0;
            l = 1;
            while(l < M){
                cnt = 0;
                for (int m = 0; m < N; m++) {
                    if(x[m] >= X[i] && x[m] <= X[j] && y[m] >= Y[k] && y[m] <= Y[l]){
                        cnt++;
                    }
                }
                if(cnt >= K){
                    ans = min(ans, (X[j] - X[i]) * (Y[l] - Y[k]));
                    k = k + 1;
                }
                else{
                    l = l + 1;
                }
            }
        }       
    }
    // for (int i = 0; i < L; i++) {
    //     printf("%lld\n", X[i]);
    // }
    // for (int i = 0; i < M; i++) {
    //     printf("%lld\n", Y[i]);
    // }
    printf("%lld\n", ans);

}

Measured memory_bytes: 3736
use std::io::*;

fn main() {
  let stdin = stdin();
  let line = stdin.lock().lines().next().unwrap().unwrap();

  let mut args = line.split_whitespace().map(|str| str.parse::<f64>().unwrap());
  let a = args.next().unwrap();
  let b = args.next().unwrap();
  let deg = args.next().unwrap();
  let rad = deg.to_radians();

  // S = 1/2 a b sinC
  let s = 0.5 * a * b * rad.sin();

  // c^2 = a^2 + b^2 - 2 a b cosC
  let c = (a * a + b * b - 2.0 * a * b * rad.cos()).sqrt();
  let l = a + b + c;

  // S = 1/2 a h
  let h = 2.0 * s / a;

  println!("{}\n{}\n{}", s, l, h);
}



Measured memory_bytes: 5200