akhauriyash/Code-Regression huggingface dataset:
import math
def comb(n, r):
  if n-r>=0:
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
  else:
    return 0
    
n=int(input())
l=[]
for i in range(n):
  s=sorted(input())
  l.append(s)
l.sort()
cnt=1
ans=0

for i in range(n-1):
  if l[i]==l[i+1]:
    cnt+=1
  else:
    ans+=comb(cnt,2)
    cnt=1
    
ans+=comb(cnt,2)    
    
print(ans)

Measured memory_bytes: 31428
#include<iostream>
#include<stdio.h>

using namespace std;
int main(){
int c,e,d,r;
double a,b,f;
      cin>>a>>b;
      d=a/b;
      c=a; 
      e=b;
      r=c%e;
      f=a/b;
         cout<<d<<" "<<r<<" ";
         printf("%.5f",f);
         cout<<endl;
         return 0;
}

Measured memory_bytes: 1284
import math as mt
A,B,H,M = map(int, input().split())
if abs(30*H+0.5*M-6*M) >= 180:
  d = 360 - abs(30*H+0.5*M-6*M)
else:
  d = abs(30*H+0.5*M-6*M)
ans = mt.sqrt(A**2+B**2-2*A*B*mt.cos(mt.radians(d)))
print(ans)

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

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); dbg(_it, args); }
void dbg(istream_iterator<string> it) {}
template<typename T, typename... Args>
void dbg(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	dbg(++it, args...);
}

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

int32_t main() {
    //ios::sync_with_stdio(false); cin.tie(nullptr);

    int A, B, Q;
    cin >> A >> B >> Q;

    vector <int> s(A), t(B);
    for (int i = 0; i < A; i++) {
        cin >> s[i];
    }

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

    while (Q--) {
        int x;
        cin >> x;

        int dsl = INF, dsr = INF, dtl = INF, dtr = INF;

        auto sr = lower_bound(all(s), x);
        if (sr - s.begin() < A) dsr = *sr;

        if (sr - s.begin() > 0) {
            auto sl = lower_bound(all(s), *prev(sr));
            if (sl - s.begin() < A) dsl = *sl;
        }

        auto tr = lower_bound(all(t), x);
        if (tr - t.begin() < B) dtr = *tr;

        if (tr - t.begin() > 0) {
            auto tl = lower_bound(all(t), *prev(tr));
            if (tl - t.begin() < B) dtl = *tl;
        }

        //debug(dsl, dsr, dtl, dtr);

        #define dist(x, a, b) min(abs(x - a) + abs(a - b), abs(x - b) + abs(b - a))

        int ans1 = dist(x, dsl, dtl);
        int ans2 = dist(x, dsl, dtr);
        int ans3 = dist(x, dsr, dtl);
        int ans4 = dist(x, dsr, dtr);

        cout << min(ans1, min(ans2, min(ans3, ans4))) << "\n";
    }

    return 0;
}


Measured memory_bytes: 2944
import java.util.Scanner;

	class Main{
		public static void main(String[]args){
            
            
        Scanner sc=new Scanner(System.in);
            int a,b;
            a=sc.nextInt();
            b=sc.nextInt();
            
            if(a<b)System.out.println("a < b");
            else if(a>b)System.out.println("a > b");
            else System.out.println("a == b");
            
            sc.close();
        }
    }


Measured memory_bytes: 26332
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())

LL a, b;

void init() {

}

void input() {
	cin >> a >> b;
}

void solve() {
	FOR(i, 1, 1000000) {
	
		LL m = i*(i+1)/2;
		LL n = (i+1)*(i+2)/2;
		if (b-a == n-m){
			cout << n - b << endl;
			return;
		}
	}
}

int main() {
	init();
	input();
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#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;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();
    int n, m;
    cin >> n >> m;
    vl a(n);
    ll sum = 0;
    rep (i, n) {
        cin >> a[i];
        sum += a[i];
    }

    int cnt = 0;
    rep (i, n) {
        if (a[i] * 4 * m >= sum) cnt++;
    }
    if (cnt >= m) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()){
            int d = sc.nextInt();
            int num = 600/d;
            long area = 0;
            for(int i=0;i<num;i++){
                area += d*(d*i)*(d*i);
            }
            System.out.println(area);
        }
    }
}

Measured memory_bytes: 25856
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  int a[100001]={};
  for(int i=0; i<n; i++){
    int ai;
    cin >> ai;
    ai--;
    a[ai] += 1;
  }
  bool minus=false;
  int ans = 0;
  for(int i=0; i<100001; i++){
    if(a[i]>0){
      ans++;
    }
  }
  if(ans%2==0) ans--;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
def main():
    N, K = map(int, input().split())
    S = input()
    num = 0
    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            num += 1
    print(min(num + 2*K, N - 1))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <stdio.h>

int main(){

  int n = 0;
  int result = 0;

  //input
  scanf("%d",&n);

  if( n % 2 != 0 ){

    result = n * 2;
    
  }else{

    result = n;
  }
  
  //output
  printf("%d\n",result);
  
  return 0;
}


Measured memory_bytes: 128
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

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

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N = I()
d = DD(int)

for _ in range(N):
  k = list(S())
  k.sort()
  k = tuple(k)
  d[k] += 1

keys  = [k for k in d]
print(sum(d[k]*(d[k]-1)//2 for k in keys))

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

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

    static class KnapSack {
        static int n;
        static int w;
        static int[] weight;
        static int[] value;
        static long[][] memo;

        public void solve(int testNumber, Scanner sc, PrintWriter pw) {
            n = sc.nextInt();
            w = sc.nextInt();
            weight = new int[n];
            value = new int[n];
            for (int i = 0; i < n; i++) {
                weight[i] = sc.nextInt();
                value[i] = sc.nextInt();
            }
            memo = new long[w + 1][n];
            for (long[] x : memo)
                Arrays.fill(x, -1);
            pw.println(dp(0, w));
        }

        private long dp(int idx, int rem) {
            if (rem < 0)
                return (int) -1e9;
            if (idx == n)
                return 0;
            if (memo[rem][idx] != -1)
                return memo[rem][idx];
            long take = 1l * value[idx] + dp(idx + 1, rem - weight[idx]);
            long leave = dp(idx + 1, rem);
            return memo[rem][idx] = Math.max(take, leave);
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

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

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

    }
}



Measured memory_bytes: 130504
#include <iostream>
using namespace std;
int main(void){
    int n;
    cin>>n;
    long long a[n];
    for (int i =0;i<n;i++){
        cin>>a[i];
    }
    long long mx=0;
    long long ans=0;
    for (int i=0;i<n;i++){
        if (mx>a[i]){
            ans+=mx-a[i];
        }
        else{
            mx=a[i];
        }
    }
    cout<<ans;
}


Measured memory_bytes: 5244
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> ar, ar_;
    for (size_t i=0; i < N; ++i) {
        int t;
        cin >> t;
        ar.push_back(t);
        ar_.push_back(t);
    }
    sort(ar.begin(), ar.end());
    
    int diff = 0;
    for (size_t i=0; i < N; ++i) {
        if (ar[i] != ar_[i])
            diff++;
    }
    if (diff > 2)
        cout << "NO" << endl;
    else
        cout << "YES" << endl;
}

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

const int MAX_N = 100;
int N;
int v[MAX_N];

int main() {
  cin >> N;
  for(int i = 0; i < N; i++) scanf("%d", &v[i]);
  
  sort(v, v + N);
  float ans = v[0];
  for(int i = 1; i < N; i++) {
    ans = (ans + v[i]) / 2;
  }
  printf("%.5f\n", ans);
  return 0;
}

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

using namespace std;
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
template<typename T> using vv = vector<vector<T>>;
template<typename T> using vvv = vector<vector<vector<T>>>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using pqg = priority_queue<T, vector<T>, greater<T>>;

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
const int DX[4] = {1, 0, -1, 0};
const int DY[4] = {0, 1, 0, -1};

#define _sel(_1, _2, x, ...) x
#define repn(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, ...) _sel(__VA_ARGS__, reps, repn)(i, __VA_ARGS__)
#define reppn(i, n) for (ll i = 1; i <= (n); i++)
#define repps(i, a, b) for (ll i = (a); i <= (b); i++)
#define repp(i, ...) _sel(__VA_ARGS__, repps, reppn)(i, __VA_ARGS__)
#define rrepn(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, a, b) for (ll i = (b) - 1; i >= (a); i--)
#define rrep(i, ...) _sel(__VA_ARGS__, rreps, rrepn)(i, __VA_ARGS__)
#define rreppn(i, n) for (ll i = (n); i >= 1; i--)
#define rrepps(i, a, b) for (ll i = (b); i >= (a); i--)
#define rrepp(i, ...) _sel(__VA_ARGS__, rrepps, rreppn)(i, __VA_ARGS__)

#define pb push_back
#define fi first
#define se second
#define rng(v) (v).begin(), (v).end()
#define rrng(v) (v).rbegin(), (v).rend()
#define siz(x) int((x).size())
#define pow2(x) (1ll << (x))
#define bit(x, n) ((x) >> (n) & 1)
#define prt(x) cout << (x) << endl
#define dbg(x) dbgn(#x, x)

template<typename T, typename U> inline bool umax(T& m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U> inline bool umin(T& m, U x) { if (m > x) { m = x; return true; } return false; }
template<typename T> inline void errv(T& v) { for (auto x: v) cerr << x << " "; cerr << endl; }
inline void errv(vb& v) { for (auto x: v) cerr << (x ? 1 : 0) << " "; cerr << endl; }
template<typename T> inline void dbgn(string n, T x) { cerr << n << ": " << x << endl; }
template<typename T> inline void dbgn(string n, vector<T>& v) { cerr << n << ": "; errv(v); }
template<typename T> inline void dbgn(string n, vv<T>& m) { cerr << n << ":" << endl; for (auto& v: m) errv(v); }


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

    prt(n * (n - 1) / 2);

    return 0;
}


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

map<int,int> mp;

main()
{
	for(int i=0;i<4;i++)
	{
		int n;
		scanf("%d",&n);
		if(n!=1&&n!=9&&n!=7&&n!=4)
		{
			printf("NO\n");
			return 0;
		}
		else
		{
			if(mp[n])
			{
				printf("NO\n");
				return 0; 
			}
			mp[n]++;
		}
	}
	printf("YES\n");
}


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

int main(){
    int N; cin >> N;
    map<string,int> A;
    string before,after;
    cin >> before;
    A[before]++;
    
    rep(i,N-1){
        cin >> after;
        if ((before.at(before.size()-1)) == after.at(0) && A[after]==0 ){
            A[after]++;
            before=after;
        }else{
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
const long long mod=1e9+7;
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 pair<int, int> P;
#define fi first
#define se second
int main(){
    int n;
    cin>>n;
vector<P> a(n);
for(int i=0;i<n;i++){
    int t,m;
    cin>>t>>m;
    a.at(i)=P(m,t);
}
sort(a.begin(),a.end());
ll sum=0;
bool flag=true;
for(int i=0;i<n;i++){
    sum+=a.at(i).se;
     if(sum>a.at(i).fi){
         flag=false;
         break;
     }
}
if(flag)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main()
{
	char X,Y;
	int A=10,B=11,C=12,D=13,E=14,F=15;
	scanf("%C %C",&X,&Y);
	if(X>Y)
		printf(">\n");
	else if(X<Y)
		printf("<\n");
	else if(X=Y)
		printf("=\n");
	return 0;
}

Measured memory_bytes: 128
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  input! {
    s: chars,
  }
  let mut s = s;
  s.sort();
  if s[0] == s[1] && s[1] != s[2] && s[2] == s[3] {
    println!("Yes");
  } else {
    println!("No");
  }
}


Measured memory_bytes: 4352
#include <iostream>

using namespace std;

int main()
{
    while (true)
    {
        int N;
        cin>>N;
        if (N==0)
            break;
        int k[10000];
        for (int i=0; i<N; i++)
            cin>>k[i];

        bool ok = false;
        int ans = 1;
        for (int i=0; i<N; i++)
        {
            if (k[i]>=1)
                ans++;
            if (k[i]>=2)
                ok = true;
        }
        if (ok)
            cout<<ans<<endl;
        else
            cout<<"NA"<<endl;
    }
}

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

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

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

int main() {
    int n;
    while(cin >> n, n){
        vector<ll> cnt(4001);
        int val = 0;
        for (int i = 0; i < n; ++i) {
            int a, b, c;
            scanf("%d %d %d", &a, &b, &c);
            cnt[a] += (ll)b*c;
            if(cnt[a] >= 1000000){
                cnt[a] = -INF<ll>;
                cout << a << "\n";
                val++;
            }
        }
        if(!val) puts("NA");
    }
    return 0;
}


Measured memory_bytes: 3180
#include<stdio.h>
int a[100009];
int main(){
	int t;
	while(~scanf("%d",&t)){
		scanf("%d",&a[0]);
		int f = 0,d = 0,sum = 1;
		for(int i = 1;i<t;i++){
			scanf("%d",&a[i]);
			if(a[i-1]>a[i])f = 1;
			if(a[i-1]<a[i])d = 1;
			if(f&&d){
				f = 0;
				d = 0;
				sum++;
			}
		}
		printf("%d\n",sum);
	}
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

constexpr int dx[9] = {0, 0, 0, -1, -1, -1, -2, -2, -2};
constexpr int dy[9] = {0, -1, -2, 0, -1, -2, 0, -1, -2};

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

    int h, w, n;
    cin >> h >> w >> n;
    map<P, int> mp;
    for(int i = 0; i < n; ++i){
        int x, y;
        cin >> x >> y;
        --x, --y;
        for(int j = 0; j < 9; ++j){
            int nx = x + dx[j], ny = y + dy[j];
            if(nx < 0 || nx >= h - 2 || ny < 0 || ny >= w - 2)  continue;
            ++mp[P(nx, ny)];
        }
    }
    vector<ll> ans(10, 0);
    ll sum = 0;
    ans[0] = (ll)(h - 2) * (w - 2);
    for(auto it : mp){
        ++ans[it.second];
        ++sum;
    }
    ans[0] -= sum;
    for(int i = 0; i < 10; ++i) cout << ans[i] << endl;
}

Measured memory_bytes: 56576
from math import gcd

def factorization(N):
    res=[]
    for i in range(2,int(N**(1/2))+2):
        if not N%i:
            r=0
            while not N%i:
                N//=i
                r+=1
            res.append((i,r))
    if N>1:
        res.append((N,1))
    return res
a,b=map(int,input().split())
g=gcd(a,b)
print(1+len(factorization(g)))

Measured memory_bytes: 63544
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N=sc.nextInt();
		double[] x=new double[N];
		String[] u=new String[N];
		double sum=0;
		
		for(int i=0;i<N;i++) {
			x[i]=sc.nextDouble();
			u[i]=sc.next();
			
			if(u[i].equals("JPY")) {
				sum+=x[i];
			}else {
				sum=sum+x[i]*380000.0;
			}
		}	
		System.out.println(sum);
	}
	
}


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

int main() {
    long long k;
    string s, ans;
    cin >> s >> k;
    ans = s[0];
    if(s[0] == '1' && k != 1) {
        for(int i = 1; i < min(s.size(), (long unsigned int)k); ++i) {
            if(s[i] != '1') {
                ans = s[i];
                break;
            }
        }
    }
    cout << ans << '\n';
}


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

int main(){
    int n;
    cin>>n;
    vector<int> h(n);
    rep(i,n) cin>>h[i];

    int cnt=0;
    int maxv=0;
    rep(i,n-1){
        if(h[i]>=h[i+1]) cnt++;
        else{
            maxv=max(maxv,cnt);
            cnt=0;
        }
        if(i==n-2) maxv=max(maxv,cnt);
    }
    cout<<maxv<<"\n";
    return 0;    
}

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

#define int long long

using namespace std;

int n;
int a[200001];
int sum[200001];

bool bin_check(int x) {

    int p1 = 0, p2 = 0;
    int sum1 = 0, sum2 = 0;

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

        // 1
        while(p1 < n + i && sum1 < x) {
            sum1 += a[p1];
            if(p1 < p2) sum2 -= a[p1];
            ++p1;
        }

        // 2
        if(!i) p2 = p1;
        while(p2 < n + i && sum2 < x) {
            sum2 += a[p2];
            ++p2;
        }

        // 3
        if(sum[n + i] - sum[p2] >= x) {
            return true;
        }

        sum1 -= a[i];
    }

    return false;

}

main() {

    cin >> n;

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

    sum[0] = 0;
    for(int i = 1; i <= 2 * n; ++i) {
        sum[i] = sum[i - 1] + a[i - 1];
    }

    int l = 0, m, r = sum[n] / 3;
    while(l + 1 < r) {
        m = (l + r) / 2;
        if(bin_check(m)) {
            l = m;
        } else {
            r = m;
        }
        //cout << l << " " << r << endl;
    }

    cout << l << endl;

}

Measured memory_bytes: 6188
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 2e5 + 5;
const int mod = 1e9 + 7;
ll a[maxn] , pre[maxn];
int main()
{
    ios::sync_with_stdio(false);
    int n ; cin >> n;
    for (int i = 1 ; i <= n ; i ++) cin >> a[i] , pre[i] = (pre[i - 1] + a[i]) % mod;
    ll ans = 0;
    for (ll i = 1 ; i <= n ; i++){
        ans = (ans + a[i] * pre[i - 1] % mod) % mod;
    }
    cout << ans <<endl;
    return 0;
}


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

bool isPalindrome(string str) 
{ 
    // Start from leftmost and rightmost corners of str 
    int l = 0; 
    int h = str.length() - 1; 
  
    // Keep comparing characters while they are same 
    while (h > l) 
    { 
        if (str[l++] != str[h--]) 
        { 
            return false;
        } 
    } 
    return true;
} 

int main(){
    
    string str;
    cin>>str;
    int n = str.length();
    string str1 = str.substr(0,((n-1)/2));
    string str2 = str.substr(((n+3)/2)-1,n-1);

    if(isPalindrome(str)==true&&isPalindrome(str1)==true&&isPalindrome(str2)==true) cout<<"Yes";
    else cout<<"No";

}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main()
{
    int i,j,h,w,a[32][32],k,l,m=2147483000,r;
    scanf("%d %d",&h,&w);
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            scanf("%d",&a[i][j]);
        }
    }
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            r=0;
            for(k=0;k<h;k++){
                for(l=0;l<w;l++){
                    r+=a[k][l]*(abs(i-k)>abs(j-l)?abs(j-l):abs(i-k));
                }
            }
            if(r<m)m=r;
        }
    }
    printf("%d\n",m);
    return 0;
}


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

const int tmax = 100010;
int N, C;
int v[30][tmax];

int main() {
	cin >> N >> C;
	memset(v, 0, sizeof(v));
	for (int i = 0; i < N; i++) {
		int s, t, c;  cin >> s >> t >> c;
		v[c - 1][s]++;
		v[c - 1][t]--;
	}
	for (int c = 0; c < C; c++) {
		for (int t = 1; t < tmax; t++) {
			v[c][t] += v[c][t - 1];
		}
		for (int t = 1; t < tmax; t++) {
			if (v[c][t] == 1 && v[c][t - 1] == 0) v[c][t - 1]++;
		}
	}

	int ans = 0;
	for (int t = 0; t < tmax; t++) {
		int buf = 0;
		for (int c = 0; c < C; c++) {
			buf += v[c][t];
		}
		ans = max(ans, buf);
	}
	cout << ans << endl;
}


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

#define INF 1 << 29
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)

using namespace std;

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

void gen_sosuu(int sosuu[]){
  REP(i,100010){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(100000)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<=100000;j++){
      //printf("%d %d %d\n",i*j,i,j);
      sosuu[i*j] =false;
    }
  }
}

bool dp[5010][5010] = {{false}};
int n,k;

vector<ll> a;

bool is_ok(int m){
  REP(i,n){
    REP(j,k) dp[i+1][j] = false;
    REP(j,k){
      if(dp[i][j]){
        dp[i+1][j] = true;
        if(i!=m && j+a[i]<k) dp[i+1][j+a[i]] = true;
      }
    }
  }
  FOR(i,max(0ll,k-a[m]),k) if(dp[n][i]) return true;
  return false;
}


int main(){
  scanf("%d %d",&n,&k);
  REP(i,n){
    ll x;
    scanf("%lld",&x);
    a.push_back(x);
  }
  sort(a.begin(),a.end());
  dp[0][0] = true;
  int l = 0, r = n+1, m;
  while(r-l>1){
    m = (r+l)/2;
    (is_ok(m-1) ? r : l) = m;
  }
  printf("%d\n",l);
}

/*
ll n,k;
vector<ll> a;

ll sum = 0;

int main(){
  scanf("%lld %lld",&n,&k);
  REP(i,n){
    int x;
    scanf("%lld",&x);
    a.push_back(x);
  }
  sort(a.begin(),a.end());
  int from = 0;
  REP(to,a.size()){
    sum += a[to];
    while(sum-a[from]>=k){
      sum -= a[from];
      from++;
    }
    //printf("%d %d %d %d\n",sum,sum-a[from],a[from],a[to]);
    if(sum>=k) break;
  }
  if(sum<k){
    printf("%d\n",n);
    return 0;
  }
  printf("%d\n",from);
  return 0;
}
*/


Measured memory_bytes: 24832
#include <iostream>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<string,int> P;
int x[10][10];
int dist(int a,int b,int d)
{
	int ret=0;
	for(int i=0;i<d;i++)
		ret+=(x[a][i]-x[b][i])*(x[a][i]-x[b][i]);
	int sq=sqrt(ret);
	if(sq*sq==ret)
		return 1;
	else
		return 0;
}
int main()
{
	int n,d;
	cin>>n>>d;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<d;j++)
			cin>>x[i][j];
	}
	int ans=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
			ans+=dist(i,j,d);
	}
	cout<<ans<<endl;
	return 0;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;
Node treeSearch(Node u, int k){
  while(u!=NIL && k!=u->key){
    if(k<u->key){
      u=u->left;
    }
    else{
      u=u->right;
    }
  }
  return u;
}


void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }
    else{
      x=x->right;
    }
  }
  z->parent=y;
  if(y==NIL){
    root=z;
  }
  else if(z->key < y->key){
      y->left=z;
    }
    else{
      y->right=z;
    }
  }

void inorder(Node u){
  if(u==NIL){
    return;
  }
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u==NIL){
    return;
  }
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}



Measured memory_bytes: 25288
import numpy as np

N, M = map(int, input().split())
A_B = [list(map(int, input().split())) for i in range(N)]
A_B = sorted(A_B)

yen = 0
cnt = 0
i = 0

while M - (cnt + A_B[i][1]) > 0:
    yen += (A_B[i][0] * A_B[i][1])
    cnt += A_B[i][1]
    i += 1

yen += (M - (cnt)) * A_B[i][0]

print(yen)

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

int main(){
   int l,n;
   cin >> n >> l;
   vector<string> s(n);
   for (int i=0;i<n;i++){
      cin >> s.at(i);
   }
   sort(s.begin(),s.end());
   for (int i=0;i<n;i++){
      cout << s.at(i);
   }
   cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include <math.h>
#include<stdio.h>
#include <climits>
#include<algorithm>
#include<string>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define LL  long long 
#define Pi 3.14159265358979;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string s;
	LL int k;//入力パート
	char x;
	int i = 0, j = 0, run = 0, flag = 0, one = 0, first = 0;
	int ans;

	//入力
	cin >> s;
	cin >> k;

	while (s[i] == '1') {
		i++;
		one++;
	}
	first = s[i] - 48;
	
	if(k <= one)cout << 1 << "\n";
	else cout << first << "\n";
	
	//1はそのまま残る
	//それ以外は無限にその数字
}


Measured memory_bytes: 256
using System;
using System.Linq;

class Program {
  static void Main() {
    var s = "";
    while ((s = Console.ReadLine()) != "0 0") {
      var t = s.Split();
      var r = t[0];
      var a = t[1];
      int h = 0;
      int b = 0;
      for (int i = 0; i < a.Length; i++) {
        if (a[i] == r[i]) h++;
        else if (r.Contains(a[i])) b++;
      }
      Console.WriteLine("{0} {1}", h, b);
    }
  }
}


Measured memory_bytes: 20248
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
ll mod=1e9+7;


int main(){
    int n,r;
    cin>>n>>r;
    int ans=0;
    if(n>=10){
        ans=r;
    }
    else{
        ans=r+100*(10-n);
    }
    cout<<ans<<endl;
    return 0;
}

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

typedef long long ll;

int main()
{
	string s;
	cin>>s;
	int cnt = 0;
	for(int i = 0;i <(int) s.size();i++)
	{
		cnt = cnt + (s[i] - '0');
	}
	if(cnt%9 == 0) cout<<"Yes\n";
	else cout<<"No\n";
}
		


Measured memory_bytes: 3744
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
struct Integer{
public:
    ll gcd(ll a,ll b){return b ? gcd(b, a % b) : a;}
    ll lcm(ll a,ll b){return a / gcd(a, b) * b;}

    bool isPrime(ll x){
        if(x < 2) return false;
        if(x == 2) return true;
        if(x % 2 == 0) return false;
        for(ll i = 3;i <= sqrt(x) + 1;i += 2) if(x % i == 0) return false;
        return true;
    }

    vector<ll> divisor(ll M){
        vector<ll> dd;
        for(ll i = 1; i * i <= M; i++){
            if(M % i == 0){
                dd.push_back(i);
                if(i * i != M) dd.push_back(M / i);
            }
        }
        sort(dd.begin(), dd.end());
        return dd;
    }

    vector<ll> factor(ll M){ //素因数分解
        vector<ll> dd;
        if(M == 1){
            dd.push_back(1);
            return dd;
        }
        for(ll i = 2; i*i <= M; i++){
            while(M % i == 0){
                dd.push_back(i);
                M /= i;
            }
        }
        if(M != 1) dd.push_back(M);
        sort(dd.begin(), dd.end());
        return dd;
    }
};

void solve(){
    ll N;
    cin >> N;
    if(N == 1){
        print(0);
        return;
    }
    Integer it;
    vector<ll> dd = it.factor(N);
    map<ll,ll> mp;
    for(auto &e: dd){
        mp[e]++;
    }
    ll ans = 0;
    for(auto &e: mp){
        ll n = e.second;
        ll cur = 1;
        while(n > 0){
            if(n >= cur){
                ans++;
                n -= cur;
                cur++;
            }else{
                break;
            }
        }

    }
    print(ans);




    

}

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

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

using namespace std;

int main()
{
  int n, m;
  vector<int> a;
  cin >> n >> m;

  int b;
  for (int i = 0; i < m; i++)
  {
    cin >> b;
    a.push_back(b);
  }

  if (n >= m)
  {
    cout << 0 << endl;
  }
  else
  {
    sort(a.begin(), a.end());
    vector<int> dif;
    for (int i = 0; i < a.size() - 1; i++)
    {
      dif.push_back(a[i + 1] - a[i]);
    }

    sort(dif.begin(), dif.end(), greater<int>());
    int res = a[m - 1] - a[0];
    for (int i = 0; i < n - 1; i++)
    {
      res -= dif[i];
    }
    cout << res << endl;
  }
}

Measured memory_bytes: 1400
import itertools
def main(n,p,q):
    d = sorted(list(itertools.permutations(p)))
    return abs(d.index(tuple(p)) - d.index(tuple(q)))
    
n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))

print(main(n,p,q))

Measured memory_bytes: 8308
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

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;}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    while(true){
        int N; cin >> N;
        if(N==0) break;
        int cnt=0;
        rep(i,N/2){
            int pos=i+1;
            int sum=pos;
            while(sum<=N){
                pos++;
                sum+=pos;
                if(sum==N){
                    cnt++;
                    break;
                }
            }
        }
        cout << cnt << endl;
    }
}


Measured memory_bytes: 3052
#include <stdio.h>
int main(void){
    
    int card[128][14];
    int n, num,i,j;
    char x;
    
    scanf("%d",&n);
    for(i=1;i<=n+1;i++){
        scanf("%c %d\n", &x, &num);
        if(x=='S') card[1][num]=1;
        else if(x=='H') card[2][num]=1;
        else if(x=='C') card[3][num]=1;   
        else if(x=='D') card[4][num]=1;
    }
    
    for(i=1;i<=4;i++){
        for(j=1;j<=13;j++){
            if(i==1&&card[i][j]==0)printf("S %d\n",j);
            else if(i==2&&card[i][j]==0)printf("H %d\n",j);
            else if(i==3&&card[i][j]==0)printf("C %d\n",j);
            else if(i==4&&card[i][j]==0)printf("D %d\n",j);
        }
    }
    return 0;
}


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

signed main() {
  int H, W;
  cin >> H >> W;

  string abc;
  abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  vector<vector<string>> S(H, vector<string>(W));
  for( int i = 0; i < H; i++ ){
    for( int j = 0; j < W; j++ ){
      cin >> S.at(i).at(j);
      if( S.at(i).at(j) == "snuke" ){
        cout << abc.at(j) << i+1 << endl;
        return 0;
      }
    }
  }
      
            
}


Measured memory_bytes: 256
#include<stdio.h>

int gcd(int,int);

int main(){
  int a,b;
  int i,j;
  int ans;

  scanf("%d", &a);
  scanf("%d", &b);
  ans = gcd(a,b);
  printf("%d\n" ,ans);

  return 0;
}

int gcd(int x, int y){
  if(y==0){
    return x;
  }

  if(x >= y){
    return gcd(y, x%y);
  }else{
    return gcd(x, y%x);
  }

}

Measured memory_bytes: 1024
N, M = map(int, input().split())
k = []
for i in range(N):
	l = list(map(int, input().split()))
	del l[0]
	k.append(l)
a = k[0]
for i in range(1, N, 1):
	a.extend(k[i])
	a = [x for x in set(a) if a.count(x) > 1]
print(len(a))


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

class Main{
  private:
  	
  public:
int n;
};
int main()
{
  int n;
  cin >> n;
  //cout << n <<endl;
  vector<int> list(n);
  for(int i =0 ; i < n; i++){
    cin >> list.at(i);
  }
  vector<string> str(n);
  for(int i = 0; i < n ; i++){
    stringstream ss;
    ss << bitset<100>(list.at(i));
    //cout << ss.str() << endl;
  	str.at(i) = ss.str() ;
  }
  vector<int> m(100);
  for(int j = 0; j < 100; j++){

    if(str.at(0).at(j) != str.at(1).at(j)){
      m.at(j) += 1;
    }
  }
  
  for(int i = 2; i < n ; i++){
    for(int j = 0; j < 100; j++){

      if(str.at(i).at(j) == '1'){
        m.at(j) += 1;
      }
    }
  }

  for(int i = 0; i < 100; i++){
    m.at(i) = m.at(i)%2;

    
  }
  string s;
  s = (accumulate(m.begin(), m.end(), 0) == 0)? "Yes" : "No";
  cout << s;
}

Measured memory_bytes: 15488
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+---test
??2??5
---+/
/+---test
?44
---+/
/+---test
7?4
---+/
/+---test
?6?42???8??2??06243????9??3???7258??5??7???????774????4?1??17???9?5?70???76???
---+/

void main(string[] args) {
  const S = readln.chomp;

  auto dp = new long[13][S.length+1];
  dp[0][0] = 1;

  foreach (i; 1..S.length+1) {
    const long x = S[i-1] == '?'? -1: S[i-1]-'0';

    foreach (j; 0..10) {
      if (x != -1 && x != j) continue;

      foreach (ki; 0..13) {
        dp[i][(ki*10 + j)%13] += dp[i-1][ki];
      }
    }
    foreach (j; 0..13) dp[i][j] %= 1000000007;
  }
  dp[$-1][5].writeln;
}


Measured memory_bytes: 13720
#include<bits/stdc++.h>
using namespace std;
int f[110];
int main()
{
	f[0] = true;
	for(int i = 4; i <= 100; ++ i)
	{
		f[i] = f[i - 4];
		if(i >= 7)
			f[i] = f[i] || f[i - 7];
	}
	int n;
	scanf("%d", &n);
	if(f[n])
		printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <iomanip>
  
using namespace std;

#define pi 3.141592653589793

struct Record {
	int t;
	int n;
	int m;
	int s;
};

typedef struct Record rec;

int solve(rec re[], int r){
	int t_s, t_e, m_q;
	int req[721] = {};
	// 540~1260を記録、t - 540すればok.
	cin >> t_s >> t_e >> m_q;
	for(int j = 0; j < r; j++){
		if(re[j].m == m_q){
			if(re[j].s == 1) req[re[j].t - 540]++;
			else if(re[j].s == 0) req[re[j].t - 540]--;
		}
	}
	int ans = 0;
	for(int j = 0; j < t_e - 540; j++){
		if(j != 0) req[j] += req[j - 1];
		// cout << j + 540 << ":" << req[j] << endl;
		if(req[j] > 0 && j >= t_s - 540) ans++;
	}
	return ans;
}

int main()
{
	int N, M;
	while(1){
		cin >> N >> M;
		if(N == 0 && M == 0) break;
		int r, q;
		cin >> r;
		rec re[1001];
		for(int i = 0; i < r; i++){
			cin >> re[i].t >> re[i].n >> re[i].m >> re[i].s;
		}
		cin >> q;
		for(int i = 0; i < q; i++){
			cout << solve(re, r) << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1176
n, y = map(int, input().split())
for i in range(n+1):
    for j in range(n-i+1):
        k = (y-10000*i-5000*j)//1000
        if ((y-10000*i-5000*j)%1000 == 0 and i+j+k==n):
            print(i, j, k)
            exit()

print(-1, -1, -1)

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

struct Set{
  ll first, second;
};

bool down(const Set &x, const Set &y)
{
  return x.second > y.second;
}

int main()
{
  int n, k;
  cin >> n >> k;
  vector<Set> sets(n);
  rep(i, n) {
    cin >> sets[i].first >> sets[i].second;
    --sets[i].first;
  }
  sort(sets.begin(), sets.end(), down);

  int flag[n] = {};
  ll ans = 0;
  ll type = 0;
  vector<ll> sec, res;

  rep(i, k) {
    ans += sets[i].second;
    if (flag[sets[i].first]++ == 0) {
      ++type;
    }
    else {
      sec.push_back(sets[i].second);
    }
  }
  ans += type * type;
  
  for (int i = k; i < n; ++i) {
    if (flag[sets[i].first]++ == 0) {
      res.push_back(sets[i].second);
    }
  }
  sort(sec.begin(), sec.end());
  sort(res.begin(), res.end(), greater<ll>() );
  
  ll tmp = ans;
  rep(i, min(sec.size(), res.size()) ) {
    tmp += res[i] + 2 * type + 1 - sec[i];
    ans = max(ans, tmp);
    ++type;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2880