akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
long binsearch(vector<long>& A,long b){
  //降順Aに対してA[i]>=bとなる最大のi
  long l=0,r=A.size();
  if(A[l]<b)return -1;
  while(r-l!=1){
    long z=(l+r)/2;
    if(A[z]>=b)l=z;
    else r=z;
  }
  return l;
}
int main(){
  long N,M;cin>>N>>M;
  vector<long>A(N);for(int i=0;i<N;i++)cin>>A[i];
  sort(A.begin(),A.end(),greater<long>());
  long l=0,r=2*A[0]+1;
  while(r-l!=1){
    long z=(l+r)/2;
    long s=0;
    for(int i=0;i<N;i++){
      s+=binsearch(A,z-A[i])+1;
    }
    if(s>M)l=z;
    else r=z;
  }
  vector<long>C(N);C[0]=A[0];
  long t=0;
  for(int i=1;i<N;i++)C[i]=C[i-1]+A[i];
  long ans=0;
  for(int i=0;i<N;i++){
    long id=binsearch(A,r-A[i]);
    if(id!=-1)ans+=C[id]+A[i]*(id+1);
    t+=(id+1);
  }
  cout<<ans+(M-t)*l;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main()
{
	int a, b, c;

	scanf("%d %d %d", &a, &b, &c);

	if (a == b && b == c)
		printf("%d\n", 1);

	else if (a != b && b != c && c != a)
		printf("%d\n", 3);

	else
		printf("%d\n", 2);

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ios>//左右揃え
#include<iomanip>//setwで幅指定

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007LL

int main(void) {
    int n, sum = 0;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    sort(s.begin(), s.end());
    string tmp = "";
    rep(i, n) {
        if (s[i] != tmp) sum++;
        tmp = s[i];
    }
    cout << sum << endl;
}

Measured memory_bytes: 9600
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n:usize,
        mut a:[i64; n],
    }
    let mut res = 0;
    for i in 0..n {
        res += a[i] / 2;
        a[i] %= 2;
        if i < n - 1 {
            if a[i] > 0 && a[i + 1] > 0 {
                a[i + 1] -= 1;
                res += 1;
            }
        }
    }

    println!("{}", res);
}


Measured memory_bytes: 3736
//#include "/Users/HIMANSHU PANDEY/Desktop/coding/stdc++.h"
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define ins insert
#define sb substr
#define con continue
#define ub upper_bound
#define lb lower_bound
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define pll pair<ll,ll>
#define pld pair<ld,ld>
using namespace std;
 
ll power(ll x, ll y);
ll mpower(ll x, ll y, ll p);
ll modInv(ll a, ll m);
ll gcdExtended(ll a, ll b, ll *x, ll *y);
bool isPrime(ll n);
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t,i,j,k,l,h,p,q,r,x,y,z,a,b,c,d,f,n,m,M=1000000007;
    char ch,ch2,ch3;
    string s,s1,s2,s3;
     t=1;
    //cin>>t;
    while(t--)
    {
        vector<ll> v,w;
        unordered_map<ll,ll> N;
        set<ll> S,SS;
		cin>>s;
		n=s.length();
		if(s[n-1]=='s')
		{
		    s.push_back('e');
		    s.pb('s');
		}
		else
		{
		    s.pb('s');
		}
		cout<<s;
    }
    return 0;
}
 
ll modInv(ll a, ll m)
{
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    ll res = (x%m + m) % m;
    return res;
}
 
ll gcdExtended(ll a, ll b, ll *x, ll *y){
    if (a == 0){
        *x = 0, *y = 1;
        return b;
    }
    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1);
    *x = y1 - (b/a) * x1;
    *y = x1;
    return gcd;
}
 
ll mpower(ll x, ll y, ll p){
    ll res = 1;
    x = x % p;
    while(y > 0){
        if(y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
 
ll power(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}
 
bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    ll p=sqrt(n);
    for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;
    return true;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, string> PS;
typedef tuple<ll, ll, ll> T;

int N, M;
vector<vector<P>> us(100001); 

int main(void){
    
    scanf("%d %d", &N, &M);
    for(int i = 0; i < M; ++i){
        int p, y; scanf("%d %d", &p, &y);
        us[p].push_back(make_pair(y, i));
    }
    for(int i = 1; i <= N; ++i) if(us[i].size()) sort(us[i].begin(), us[i].end());
    
    vector<PS> v;
    for(int i = 1; i <= N; ++i){
        for(int j = 0; j < us[i].size(); ++j){
            string p, y;
            p = to_string(i), y = to_string(j + 1);
            string a(6 - (int)p.size(), '0'), b(6 - (int)y.size(), '0');
            a = a + p, b = b + y;
            v.push_back(make_pair(us[i][j].second, a + b));
        }
    }
    sort(v.begin(), v.end());
    
    for(int i = 0; i < v.size(); ++i) cout << v[i].second << endl; 
    
    return 0;
}


Measured memory_bytes: 13168
import decimal
import math

while True:
    try:
        x=float(input())
        #print("x",x)
        N=1
        while True:
            h=5*N-5                                             #h=height
            decimal.getcontext().prec=4                         #小数点以下を指定
            v=decimal.Decimal(9.8*(math.sqrt(h/4.9)))           #v=velocity
            if v>=x:
                print(N)
                break
            N+=1
    except:
        break




Measured memory_bytes: 6424
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <vector>
#include <iostream>
#include <utility>
using namespace std;
using ll = long long;

int main(){
  int N, M;
  cin >> N >> M;
  vector<pair<ll,ll>> V;
  for(int i = 0; i < N; ++i){
    int s, v;
    cin >> s >> v;
    V.emplace_back(v,s);
  }
  sort(V.begin(),V.end());
  vector<ll> C(M);
  for(int i = 0; i < M; ++i) cin >> C[i];
  sort(C.rbegin(),C.rend());
  int j = N-1;
  int ans = 0;
  for(int i = 0; i < M; ++i){
    while(j >= 0 and V[j].second > C[i]) --j;
    if(j < 0 or V[j].second > C[i]) break;
    ++ans;
    --j;
    if(j < 0) break;
  }
  cout << ans << endl;
}



Measured memory_bytes: 5164
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

	int N;
	cin >> N;
	vector<int> p(N), q(N);
	REP(i, N) { cin >> p[i]; }
	REP(i, N) { cin >> q[i]; }
	vector<int> v(N);
	REP(i, N) { v[i] = i + 1; }
	int a, b;
	int cnt = 0;
	do {
		++cnt;
		if (p == v) a = cnt;
		if (q == v) b = cnt;
	} while (next_permutation(v.begin(), v.end()));
	cout << abs(a - b) << endl;

	return 0;
}


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

typedef long long ll;
// 22:22
// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

// bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
//     return arg1.first > arg2.first;
// }

// template<class T> void chmin(T& a, T b) {
//     if (a > b) {
//         a = b;
//     }
// }

// template<class T> void chmax(T& a, T b) {
//     if (a < b) {
//         a = b;
//     }
// }

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

    vector <int> p(n+1);
    int tmp, cnt;
    for(int in=1;in<=n;in++) {
        tmp = in;
        for(int j=2;j*j<=tmp;j++) {
            cnt = 0;
            while(tmp%j==0) {
                tmp /= j;
                cnt++;
            }
            p.at(j) += cnt;
        }
        if(tmp>1) {
            p.at(tmp) += 1;
        }
    }

    int count74=0, count24=0, count14=0, count4=0, count2=0;
    for(auto ip:p) {
        if(ip>=74) count74++;
        if(ip>=24) count24++;
        if(ip>=14) count14++;
        if(ip>=4) count4++;
        if(ip>=2) count2++;
    }

    cout << count74 + count24*(count2-1) + count14*(count4-1) + (count4)*(count4-1)*(count2-2)/2 << endl;

    // for(auto ip:p) {
    //     cout << ip << endl;
    // }

    return 0;
}


Measured memory_bytes: 256
import sys

p = [0] * 4001
v = 0
for i in range(2001):
    t = (i+3)*(i+2)*(i+1)//6
    v = v + 2 * (i-999) * (i-1000) if i > 1000 else 0
    p[i] = t - v
    p[4000-i] = p[i]

for i in sys.stdin:
    print(p[int(i)])

Measured memory_bytes: 7708
//#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;

  #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

  #define ff first
  #define ss second
  #define pb push_back
  #define pf push_front
  #define mp make_pair
  #define in insert
  #define ld long double


  #define TRACE
  #ifdef TRACE
  #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
  template <typename Arg1>
  void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
  }
  template <typename Arg1, typename... Args>
  void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
  }
  #else
  #define trace(...) 1
  #endif
  template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
  template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}

  typedef long long int ll;

  typedef vector<int> vi;
  typedef vector<ll> vl;
  typedef vector<vi> vvi;
  typedef vector<vl> vvl;
  typedef pair<int,int> pii;
  typedef pair<ll,ll> pll;
  typedef vector<pii> vpii;
  typedef vector<pll> vpll;
  const ll mod =1e9+7;
  const ll MAX_NODES =200001;
  const ll MAX_LOG =50;
  const ll maxn = 200000+10;
  #define endl '\n'
  ll power(ll x, ll n) {
      ll res = 1;
      for (; n > 0; n >>= 1) {
      if (n & 1) res = (res * x) % mod;
      x = (x * x) % mod;
      }
      return res;
  }


  int main()
  {

  IOS
  ll n,r;
  cin>>n>>r;
  if(n>=10)
  {
    cout<<r<<endl;
  }
  else
  {
    cout<<r+100*(10-n)<<endl;
  }
  

  
  

}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <math.h>
#include <utility>
#include <algorithm>
#include <functional>
#include <vector>
#include <numeric>
#include <bits/stdc++.h>

#define int long long

struct edge {
    int to;
    int cost;
};

using namespace std;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vb = vector<bool>;
using qi = queue<int>;
using P = pair<int, int>;
using graph = vector<vector<edge>>;
// using graph = vector<vector<int>>;


#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define delim(i, n) cout << (i == n-1 ? "\n" : " ");

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

const int inf = 1LL << 60;
// const int inf = 100000000;
const int mod = 1000000007;

const int maxn = 100000;
int n, m;
vi a(maxn);
vi table(maxn);

vi dx = {-1, 0, 0, 1};
vi dy = {0, -1, 1, 0};

int lds() {
    table.resize(n);
    REP(i, n) {
        table[i] = -1;
    }
    REP(i, n) {
        auto iter = upper_bound(table.begin(), table.end(), a[i], [](const int& a, const int& b) { return a > b; });
        *iter = a[i];
    }
    auto iter = lower_bound(table.begin(), table.end(), -1, [](const int& a, const int& b) { return a > b; });
    return (int) (iter - table.begin());
}

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

    // https://onlinejudge.u-aizu.ac.jp/problems/DPL_1_D
    cin >> n;
    REP(i, n) {
        cin >> a[i];
    }

    int ret = lds();
    cout << std::fixed << std::setprecision(10) << ret << "\n";
}

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

int main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

//write code hare


	int n;
	cin >> n;

	int d = (n % 10);

	if (d == 2 || d == 4 || d == 5 || d == 7 || d == 9 ) {
		cout << "hon";
	}
	else if (d == 0 || d == 1 || d == 6 || d == 8 ) {
		cout << "pon";
	}
	else if (d == 3 ) {
		cout << "bon";
	}
}

Measured memory_bytes: 3032
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int s = sc.nextInt();
		int cnt = 0;
		for (int x = 0; x <= k; x++) {
			for (int y = 0; y <= k; y++) {
				if (s - x - y >= 0 && s - x - y <= k) { 
					cnt++;
				}
			}
		}
		System.out.println(cnt);
	}
}


Measured memory_bytes: 23764
#include "bits/stdc++.h"
using namespace std;
typedef string djrjfrogj;
bool cmp(djrjfrogj a,djrjfrogj b){
    return a<b;
}
int main(){
    int n,grmgktr;
    cin>>n>>grmgktr;
    djrjfrogj s[n];
    for(int i=0;i<n;i++)
        cin>>s[i];
    sort(s,s+n,cmp);
    for(int i=0;i<n;i++)
        cout<<s[i];
    return 0;
}

Measured memory_bytes: 256
n = int(input())
job = []
for i in range(n) :
	a,b = map(int, input().split())
	job.append([a,b])
job = sorted(job, key=lambda job: job[1])

time = 0
b = True
for i in range(len(job)) :
	time += job[i][0]
	if (time > job[i][1]) : b = False
if (b) : print("Yes")
else : print("No")

Measured memory_bytes: 39692
import queue
import math
import copy
"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""

N = int(input())
A = N//100
B = N%100

print((A*5>=B)*1)


Measured memory_bytes: 4336
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
map<int, int> mp;
const int maxn = 202020;
char ch[maxn];
int rem[maxn], dp[maxn];
int main(){
    memset(dp, 127, sizeof(dp));
    dp[0] = 0;
    mp[0] = 0;
    scanf("%s", ch+1);
    int n = strlen(ch+1);
    for(int i = 1; ch[i] != '\0'; i ++){
        rem[i] = rem[i-1] ^ (1 << (ch[i] - 'a'));
    }
    
    for(int i = 1; i <= n; i ++){
        if(mp.find(rem[i]) != mp.end()){
            dp[i] = dp[mp[rem[i]]];
        }
        for(int j = 0; j < 26; j ++){
            if(mp.find(rem[i] ^ (1<<j)) == mp.end())
                continue;
            
            dp[i] = min(dp[i], dp[mp[rem[i] ^ (1<<j)]] + 1);
        }
        mp[rem[i]] = i;
    }
    if(!rem[n])
        dp[n] = 1;
    printf("%d", dp[n]);
    return 0;
}


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

struct Benri { Benri() { std::cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12);}} benri;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
using ull = unsigned long long;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

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

constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
constexpr int INF = 1001001001;
//constexpr ll INF = 1001001001001001001ll;
constexpr double EPS = 1e-10;
using number = long long;


const number MAX = 100005;
number fac[MAX], finv[MAX], inv[MAX],Sum[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    Sum[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
        Sum[i] = (Sum[i-1] + inv[i]) % MOD;
    }
}

int main() {
    COMinit();
    ll N; cin >> N;
    ll ans = 0;
    
    rep(i,N){
        ll a; cin >> a;
        ll c = (Sum[i+1] + Sum[N-i] -1) * fac[N] % MOD;
        ans = (ans + a * c) % MOD;
    }

    cout << ans << endl;

}

Measured memory_bytes: 3328
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007
 
ll d[550][550];
 
int main() {
  ll h,w,h1,w1;
  cin>>h>>w>>h1>>w1;
  rep(y,0,h){
    rep(x,0,w){
      d[y][x] = 1;
    }
  }
  for(ll y = 0; y < h; y += h1){
    for(ll x = 0; x < w; x += w1){
      if(y+h1-1<h&&x+w1-1<w){
        d[y+h1-1][x+w1-1] = -(h1*w1)-200000;
      }
      if(x+w1-1<w){
        d[y][x+w1-1] += 100000;
      }
      if(y+h1-1<h){
        d[y+h1-1][x] += 100000;
      }
    }
  }
  ll a = 0;
  rep(y,0,h){
    rep(x,0,w){
      a += d[y][x];
    }
  }
  if(a<=0){
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  rep(y,0,h){
    rep(x,0,w){
      cout << d[y][x];
      if(x!=w-1)cout << " ";
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int,P> P3;
const ll MOD = ll(1e9+7);
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int n;
    cin >> n;
    REP(i,n){
        int a, b;
        cin >> a >> b;
        cout << (a-1)%b+1 << endl;
    }
    return 0;
}



Measured memory_bytes: 3064
#include "bits/stdc++.h"
// #include <boost/multi_array.hpp>
// #include <boost/optional.hpp>
// #include <boost/range/irange.hpp>
// #include <boost/range/algorithm.hpp>
// #include <boost/range/adaptors.hpp>

// namespace adaptor = boost::adaptors;

using ll = long long;
using i64 = int64_t;

void Main()
{
   std::string S;
   int N, K;
   ll ans;
   std::cin >> N >> K;
   std::cin >> S;
   if (S[K - 1] == 'A')
   {
      S[K - 1] = 'a';
   }
   if (S[K - 1] == 'B')
   {
      S[K - 1] = 'b';
   }
   if (S[K - 1] == 'C')
   {
      S[K - 1] = 'c';
   }
   std::cout << S << std::endl;
}

int main()
{
   std::cin.tie(nullptr);
   std::ios_base::sync_with_stdio(false);
   std::cout << std::fixed << std::setprecision(15);
   Main();
   return 0;
}


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

s = input()

if int(s[:2]) < 13 and int(s[:2]) > 0:
    if int(s[2:]) < 13 and int(s[2:]) > 0:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if int(s[2:]) < 13 and int(s[2:]) > 0:
        print("YYMM")
    else:
        print("NA")


Measured memory_bytes: 2940
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define gcd __gcd
#define F first
#define B begin()
#define E end()
#define ln length()
#define sz size()
#define S second
#define em empty()
#define mp make_pair
#define pb push_back
#define pq priority_queue
#define um unordered_map
#define us unordered_set
#define lb lower_bound
#define ub upper_bound
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
#define sbits(a) __builtin_popcount(a)
#define lcm(a, b) ((a * b) / gcd(a, b))
#define nani(x) cerr << #x << " is " << x << endl;
#define adde(g, u, v) g[u].pb(v), g[v].pb(u);
#define addew(g, u, v, w) g[u].pb({ v, w }), g[v].pb({ u, w });
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define inf 10000000000
#define mod 1000000007

typedef long long ll;

const int N = 1e5 + 5;

pair<int, int> A[N];

int main()
{
    fast;

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> A[i].F;
        A[i].S = i;
    }

    sort(A + 1, A + n + 1);

    for (int i = 1; i <= n; i++)
        cout << A[i].S << " ";

    return 0;
}


Measured memory_bytes: 1664
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type Abbreviation ---------- */
using ll = long long;

/* ---------- Constants  */
const ll MOD = 1e9 + 7;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const double PI = acos(-1);
// const double EPS = 1e-10;
// mt19937 mert(LL(time(0)));

/* ---------- Short Functions ---------- */
template <typename T>
T gcd(T a, T b) {
    if (a > b) return gcd(b, a);
    return a == 0 ? b : gcd(b % a, a);
}

template <typename T, typename U>
T mypow(T b, U n) {
    if (n == 0) return 1;
    if (n == 1) return b /* % MOD */;
    if (n % 2 == 0) {
        return mypow(b * b /* % MOD */, n / 2);
    } else {
        return mypow(b, n - 1) * b /* % MOD */;
    }
}

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */

int main() {
    int N, c;
    cin >> N >> c;

    int time = (int) pow(10, 5) + 1;

    int table[time][c];
    fill(table[0], table[time], 0);

    for (int i = 0; i < N; i++) {
        int s, t, c;
        cin >> s >> t >> c;
        c--;

        table[s][c]++;
        table[t][c]--;
    }

    for (int i = 1; i < time; i++) {
        for (int j = 0; j < c; j++) {
            table[i][j] += table[i-1][j];
        }
    }

    for (int i = 1; i < time; i++) {
        for (int j = 0; j < c; j++) {
            if (table[i][j] != 0 && table[i-1][j] == 0) table[i-1][j] = 1;
        }
    }

    int ret = -1;
    for (int i = 0; i < time; i++) {
        int cnt = 0;

        for (int j = 0; j < c; j++) {
            cnt += table[i][j];
        }

        ret = max(ret, cnt);
    }

    cout << ret << endl;
}

Measured memory_bytes: 11904
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int main(){
    int n,tx,ty;
    cin >> n;

    vector<pii> ab(n),cd(n);
    for(int i = 0; i < n; i++){
        cin >> tx >> ty;
        ab[i].first = tx;
        ab[i].second = ty;
    }
    for(int i = 0; i < n; i++){
        cin >> tx >> ty;
        cd[i].first = tx;
        cd[i].second = ty;
    }
    sort(ab.begin(),ab.end());
    sort(cd.begin(),cd.end());
    int ans = 0;
    int x, y, ymax, idx;
    for(int i = 0; i < n; i++){
        ymax = -1;
        for(int j = 0; j < n; j++){
            x = cd[i].first - ab[j].first;
            y = cd[i].second - ab[j].second;
            if(x>0 && y>0 && ymax<ab[j].second){
                ymax = ab[j].second;
                idx = j;
            }
        }
        if(ymax != -1){
            ab[idx].first = 999;
            ab[idx].second = 999;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()

from collections import defaultdict
def resolve():
    n,W=map(int,input().split())
    WV=[tuple(map(int,input().split())) for _ in range(n)]

    weight=set()
    for i in range(n+1):
        if(WV[0][0]*i>W): break
        for j in range(3*i+1):
            if(WV[0][0]*i+j>W): break
            weight.add(WV[0][0]*i+j)
    weight=sorted(weight)

    dp=defaultdict(int)
    for i in range(n):
        ndp=defaultdict(int)
        w,v=WV[i]
        for key in weight:
            ndp[key]=max(ndp[key],dp[key])
            if(key+w<=W): ndp[key+w]=max(ndp[key+w],dp[key]+v)
        dp=ndp

    print(max(dp.values()))
resolve()

Measured memory_bytes: 81060
#include <iostream>

int main(void)
{
    int N, *a;
    int n_swap = 0;
    std::cin >> N;
    a = new int[N];
    for (int i = 0; i < N; ++i) {
        std::cin >> a[i];
    }

    for (int i = 0; i < N; ++i) {
        for (int j = N - 1; j >= i + 1; --j) {
            if (a[j - 1] > a[j]) {
                int tmp = a[j];
                a[j] = a[j - 1];
                a[j - 1] = tmp;
                ++n_swap;
            }
        }
    }
    
    for (int i = 0; i < N; ++i) {
        std::cout << a[i];
        if (i != N - 1) std::cout << " ";
    }
    std::cout << std::endl;
    std::cout << n_swap << std::endl;

    return 0;
}



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

int main () {

    int N, M, C;
    cin >> N >> M >> C;

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

    int A[N][M];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            cin >> A[i][j];
        }
    }

    int ac = 0;

    for (int i = 0; i < N; i++) {

        int sum = 0;

        for (int j = 0; j < M; j++) {
            sum += A[i][j] * B[j];
        }
        sum += C;

        if (sum > 0) ac++;
    }
    cout << ac << endl;

    return 0;
}


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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    if((c < a && b < c) || (a < c && c < b)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}


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

// varibable settings
#define int long long
const int INF=1e18;
const int MOD=1e9+7;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

signed main() {
  int a,b,c;cin>>a>>b>>c;
  if ((a+b+c)>=22) {
    cout << "bust" << endl;
  }
  else{
    cout << "win" << endl;
  }
  return 0;
}


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

int main() {
  ll a, b;
  cin >> a >> b;
  if((a + b) % 2 == 0) {
    cout << (a + b) / 2 << endl;
  }else {
    cout << "IMPOSSIBLE" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<30;

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

bool eq(string *s1, string *s2) {
  REP(k,4) {
    bool f = true;
    REP(i,4) {
      if (s1[i] != s2[(i+k)%4])
        f = false;
    }
    if (f)
      return true;
  }
  return false;
}

int main() {
  int hoge[6][4] = {{1,3,4,2},{0,2,5,3},{0,4,5,1}
                    ,{0,1,5,4},{0,3,5,2},{1,2,4,3}};
  int n;
  while(cin >> n, n) {
    string side[n][4];
    REP(iii,n) {
      string s[6];
      int p;
      REP(i,6) {
        cin >> s[i];
        if (s[i] == "Red")
          p = i;
      }
      REP(i,4) {
        side[iii][i] = s[hoge[p][i]];
//        cout << side[iii][i] << " ";
      }
      //    cout << endl;
    }
    UnionFind u(n);
    REP(i,n-1) {
      for (int j=i+1; j<n; ++j) {
        if (eq(side[i], side[j])) {
          u.unionSet(i,j);
        }
      }
    }
    set<int> se;
    REP(i,n) {
      se.insert(u.root(i));
    }
    cout << n-se.size() << endl;
  }
}

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

using namespace std;

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
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;
}

void solve(std::string C) {
    cout << (char) (C[0] + 1) << endl;
}

int main() {
    std::string C;
    std::cin >> C;
    solve(C);
    return 0;
}


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

int main() {

    int n, k, x, y;
    scanf("%d%d%d%d", &n, &k, &x, &y);
    
    if(n>=k){
        printf("%d",k*x+(n-k)*y);
    }else{
        printf("%d",n*x);
    }
    
    return 0;

}


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


using namespace std;


using ll = long long;


mt19937 mt(736);

ll area(const pair<int, int> &a, const pair<int, int> &b)
{
	return abs(a.first * (ll) b.second - a.second * (ll) b.first);
}


void solve(istream &cin = std::cin, ostream &cout = std::cout)
{
	ll s;

	cin >> s;

	int y = (s + (int) 1e9 - 1) / (int) 1e9;
	int x = (ll) 1e9 * y - s;

	assert(y >= 1 && x >= 0);

	assert(area({x, y}, {(int) 1e9, 1}) == s);

	cout << "0 0 " << x << ' ' << y << ' ' << (int) 1e9 << " 1" << endl;

	return;
}


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

	cout << fixed;

#ifdef LOCAL
	auto st = clock();

	ifstream fin("../input.txt");

	stringstream ss;

	ss << (ll)(1e18) - ((int)1e9 + 7);

	solve(ss);

	cout << "clock: " << setprecision(4) << (clock() - st) / (double) CLOCKS_PER_SEC << endl;
#else
	solve();
#endif

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());

		String[] tempA = sc.nextLine().split(" ");
		String[] tempB = sc.nextLine().split(" ");
		String[] tempC = sc.nextLine().split(" ");

		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[n];
		int ans = 0;

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

			a[i] = Integer.parseInt(tempA[i]);
			b[i] = Integer.parseInt(tempB[i]);
			c[i] = i == n - 1 ? 0 : Integer.parseInt(tempC[i]);

		}

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

			ans += b[a[i] - 1] ;

			if(i < n - 1 && a[i] == a[i + 1] - 1) {

				ans += c[a[i] - 1];

			}
		}

		System.out.println(ans);

	}

}


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

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  bool judge = false;
  if (S[2]==S[3])
  {
    if (S[4] == S[5])
    {
      judge = true;
    }
    
  }

  if (judge)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  
  return 0;
}




Measured memory_bytes: 256
using System;

namespace _174_c
{
    internal class Repsept
    {
        private static void Main(string[] args)
        {
            var k = int.Parse(Console.ReadLine() ?? throw new InvalidOperationException());

            long seven = 7;
            for (var i = 0; i < k; i++)
            {
                var remainder = seven % k;
                if (remainder == 0)
                {
                    Console.WriteLine(i + 1);
                    return;
                }

                seven = remainder * 10 + 7;
            }

            Console.WriteLine(-1);
        }
    }
}

Measured memory_bytes: 27416
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n,ans=0;
  map<string,int> date;
  string s;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s;
    sort(s.begin(),s.end());
    date[s]++;
    if(date[s]>1) ans+=(date[s]-1);
  }
  cout<<ans<<"\n";
}

Measured memory_bytes: 11136
import math

def isPrime(n):
  if n == 2:
    return True
  if n % 2 == 0:
    return False
  
  m = math.floor(math.sqrt(n)) + 1
  for p in range(3, m, 2):
    if n % p == 0:
      return False
  return True

N = int(input())
ans = []

for i in range(2,55556):
  if isPrime(i) and i%5 == 1:
    ans.append(i)
  if len(ans) == N:
    break

print(*ans)

Measured memory_bytes: 9024
#include<iostream>
using namespace std;
const long mod=1e9+7;
long power(long a,long b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
int K;
string S;
long fac[2<<20],inv[2<<20];
long comb(int X,int Y){return fac[X]*inv[Y]%mod*inv[X-Y]%mod;}
main()
{
	cin>>K>>S;
	int T=K+S.size();
	fac[0]=1;
	for(int i=1;i<=T;i++)fac[i]=fac[i-1]*i%mod;
	inv[T]=power(fac[T],mod-2);
	for(int i=T;i--;)inv[i]=inv[i+1]*(i+1)%mod;
	long ans=0;
	for(int i=S.size();i<=K+S.size();i++)
	{
		ans+=comb(T,i)*power(25,T-i)%mod;
	}
	cout<<ans%mod<<endl;
}


Measured memory_bytes: 35548
#include<cstdio>
#include<algorithm>
using namespace std;
int mod=1000000007,n,f[3005],pre[3005],suf[3005];
int main()
{
    scanf("%d\n",&n);f[1]=pre[1]=suf[1]=1;
    for(int i=2;i<=n;i++){
        if(getchar()=='<') for(int j=1;j<=i;j++) f[j]=pre[j-1];
        else for(int j=1;j<=i;j++) f[j]=suf[j];
        for(int j=1;j<=i;j++) pre[j]=(pre[j-1]+f[j])%mod;
        for(int j=i;j>=1;j--) suf[j]=(suf[j+1]+f[j])%mod;
    }
    printf("%d\n",pre[n]);
    return 0;
}

Measured memory_bytes: 256
//#include "pch.h"
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <math.h>
#define OO INT_MAX
#define mp(x,y) make_pair(x,y)
#define x first
#define y second
#define ll unsigned long long int
#define pp pair<int,int>
#define heap priority_queue<pp, vector<pp>, greater<pp>>
using namespace std;

int main()
{
//	freopen("test.txt", "r", stdin);

	int n;
	int in;
	cin >> n;
	vector<int> x;
	int S=0;
	for (int i = 1; i <= n; i++) {
		cin >> in;
		S += in;
		x.push_back(in);
	}
	int p1 = ceil(((double)S / (double)n));
	int p2 = floor(((double)S / (double)n));
	ll ans1 = 0, ans2 = 0;
	for (int i = 0; i < n; i++) {
		ans1 += (p1 - x[i])*(p1 - x[i]);
	}
	for (int i = 0; i < n; i++) {
		ans2 += (p2 - x[i])*(p2 - x[i]);
	}
	cout << min(ans1, ans2);
}




Measured memory_bytes: 256
n,m,k = [int(x) for x in input().split(' ')]

t1 = [int(x) for x in input().split(' ')]
t2 = [int(x) for x in input().split(' ')]

s1,s2 = 0,0

s1_s = []

s1_s.append(0)
for i in range(n):
  if s1 + t1[i] > k:
    break
  s1 += t1[i]
  s1_s.append(s1)
  
  
  
p2 = 0
max_b = 0
# print(s1_s, t2)
for i in range(len(s1_s)):
  av = k - s1_s[len(s1_s)-i-1]
  if (p2 >= m): break
  while (s2 + t2[p2]) <= av:
    s2 += t2[p2]
    p2 += 1
    if (p2 >= m): 
        # print(p2)
        break
    

#   print(s1_s[len(s1_s)-i-1], s2)
    
  
  all_b = len(s1_s)-i-1 + p2
  
  if max_b < all_b:
    max_b = all_b

print(max_b)
  

Measured memory_bytes: 40696
#include<iostream>
#include<cstdio>
using namespace std;
#define int long long
inline int read(){
	int a=0,b=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')b=-1;c=getchar();}
	while(isdigit(c)){a=a*10+c-'0';c=getchar();}
	return a*b;
}
int a1,a2,a3;
signed main(){
	a1=read();a2=read();a3=read();
	a1+=a2+a3;
	if(a1>=22)printf("bust\n");
	else printf("win\n");
	return 0;
}

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

int main() {
	int n; cin >> n;
	int a[n];
	for (int i=1; i<=n; ++i) cin >> a[i];
	
	long long now=1000;
	for (int i=1; i<n;++i) {
		if (a[i] < a[i+1]) {
			long long c=now/a[i];
			now += c*(a[i+1]-a[i]);
		}
	}
	cout << now << endl;
}

Measured memory_bytes: 3608
/**
       ▂▃▅▇█▓▒░۩۞۩ ۩۞۩░▒▓█▇▅▃▂
      AnTi-MiRaGe on Anti-Mage xD
       ▂▃▅▇█▓▒░۩۞۩ ۩۞۩░▒▓█▇▅▃▂
**/
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <iomanip>
#include <utility>
#include <memory.h>
#include <math.h>
#include <time.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <set>
#include <map>

#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define show puts("Debug")

using namespace std;

const int N = 1e5 + 5;

int pref[N], suf[N], n, ar[N];

main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> ar[i], pref[i] = pref[i - 1] + abs(ar[i] - ar[i - 1]);

    for (int i = n; i >= 1; i--)
        suf[i] = suf[i + 1] + abs(ar[i + 1] - ar[i]);

    for (int i = 1; i <= n; i++)
    {
        cout << pref[i - 1] + suf[i + 1] + abs(ar[i - 1] - ar[i + 1]) << " " ;
    }
}


Measured memory_bytes: 2432
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
#include<bitset>

using namespace std;
#define modd 1000000007
#define moda 1000003


typedef pair<long long, long long> pl;



#define ll long long




/*
class UnionFind {
public:
	vector <ll> par; 
	vector <ll> siz;
	vector <ll> gr;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) ,gr(sz_){
		for (ll i = 0; i < sz_; ++i) par[i] = i; 
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};*/


long long N, M, K, a, b, c, d,e, H, W;
long long A[200005] = {};
long long B[200005] = {};
long long C[200005] = {};
ll X[2][51] = {};
ll Y[2][51] = {};
ll sx, sy, ex, ey;
bool f, ff,fff;
string S[2];
set <long long>sll;
pl bufpl;
vector <long long>vl[100005];
vector <pl>vpl[2];
vector <string> vs[2];
set<ll> llset;

struct ST
{
	long long Kati;
	int bangou;

	bool operator<(const ST& another) const
	{
		return Kati < another.Kati;//比較
	};

};



vector <ST> vst;
ST st[200005];
ST bufst;
string bufS;

string sss;

bitset<5000> bits;

int main() {


	while (true) {
		cin >> S[0];
		if (S[0] == ".") {
			break;
		}
		cin >> S[1];



		a = 0;

		sss = "";
		bufS = sss;

		for (int i = 0; i < S[0].size(); i++) {

			if (S[0][i] == '"') {
				if (a % 2 == 0) {
					vs[0].push_back(bufS);
					bufS = sss;
				}
				else {
					vs[0].push_back(bufS);
					bufS = sss;
				}


				a++;
			}
			else {
				bufS += S[0][i];
				if (i == S[0].size() - 1) {
					vs[0].push_back(bufS);
					bufS = sss;
				}
			}
			

		}

		a = 0;

		sss = "";
		bufS = sss;

		for (int i = 0; i < S[1].size(); i++) {

			if (S[1][i] == '"') {
				if (a % 2 == 0) {
					vs[1].push_back(bufS);
					bufS = sss;
				}
				else {
					vs[1].push_back(bufS);
					bufS = sss;
				}


				a++;
			}
			else {
				bufS += S[1][i];
				if (i == S[1].size() - 1) {
					vs[1].push_back(bufS);
					bufS = sss;
				}
			}


		}

		if (vs[0].size() != vs[1].size()) {
			cout << "DIFFERENT" << endl;
		}
		else {
			a = 0;
			for (int i = 0; i < vs[0].size(); i++) {

				
				if (vs[0][i] != vs[1][i]) {
					if (i % 2 == 0) {
						a += 2;
					}
					else {
						a++;
					}
				}

				
				

			}

			if (a == 0) {
				cout << "IDENTICAL" << endl;
			}
			else if (a == 1) {
				cout << "CLOSE" << endl;
			}
			else {
				cout << "DIFFERENT" << endl;
			}

		}


		vs[0].clear();
		vs[1].clear();
		

	}

	return 0;

}



Measured memory_bytes: 5512
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INF = 1000000007;
const int mod = 1000000007;

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

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

int main()
{
    long long n, k;
    cin >> n >> k;
    ll a, b;
    map<ll, ll> rensou;
    for (int i = 0; i < n; i++)
    {
        cin >> a >> b;
        rensou[a] += b;
    }
    ll cnt = 0, i = 0;
    while (cnt < k)
    {
        i++;
        cnt += rensou[i];
    }
    cout << i << endl;
}


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

int main() {
  int q;
  vector<int> v;
  cin >> q;

  for(int i = 0; i < q; ++i) {
    int cmd, data;
    cin >> cmd;

    //push back
    if(cmd == 0) {
      cin >> data;
      v.push_back(data);
    }
    // random access
    else if(cmd == 1) {
      cin >> data;
      cout << v[data] << endl;
    }
    // pop back
    else {
      v.pop_back();
    }
  }
  return 0;
}



Measured memory_bytes: 3808
#include <iostream>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

void printArray(int *A, int n) {
  rep(i, n) {
    std::cout << A[i];
    if (i == n - 1)
      std::cout << '\n';
    else
      std::cout << ' ';
  }
}

void insertionSort(int *A, int n) {
  rep(i, n - 1) {
    int j = i + 1;
    int v = A[j];
    for (j = i; j >= 0; --j) {
      if (v < A[j])
        A[j + 1] = A[j];
      else
        break;
    }
    A[j + 1] = v;
    printArray(A, n);
  }
}

int main() {
  int n;
  std::cin >> n;
  int A[n];
  rep(i, n) std::cin >> A[i];

  printArray(A, n);
  insertionSort(A, n);

  return 0;
}



Measured memory_bytes: 3076
x1,y1,x2,y2 = map(int,input().split())
x3 = x2 - y2 + y1
y3 = y2 + x2 - x1
x4 = x1 - y2 + y1
y4 = y1 - x1 + x2
print(x3,y3,x4,y4)

Measured memory_bytes: 9100
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main() 
{
  int a, b, c, d;
  cin >> a >>b >> c >> d;
  cout << max(a*b, c*d) << endl;
  system("pause");
}


Measured memory_bytes: 504
#include <iostream>
#include <cmath>
#include <cstdio>
#include <limits.h>
using namespace std;

typedef long long ll;

int get(ll n){
	int t = 0;
	while(n){
		t++;
		n/=10;
	}
	return t;
}

int main(){
	// freopen("input.txt", "r", stdin);
	ll N;
	cin>>N;
	int res = INT_MAX;
	for (ll i = 1; i * i <= N; ++i)
	{
		if(N % i == 0){
			res = min(res, max(get(i),get(N/i)));
		}
	}
	cout << res << endl;
	return 0;
}

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

int main(){
  int n,k; cin>>n >>k;
  vector<int> l(n);
  for(int i=0;i<n;i++){
    cin>>l[i];
  }
  sort(l.begin(),l.end());
  reverse(l.begin(),l.end());
  int ans=0;
  for(int i=0;i<k;i++){
    ans+=l[i];
  }
  cout<<ans<<endl;
}

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

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

  sort(S.begin(), S.end());
  S.erase(unique(S.begin(), S.end()), S.end());

  cout << ((S == "ENSW" || S == "NS" || S == "EW") ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# coding: utf-8
def main():
    A, B, C, K = map(int, input().split())
    s = 0
    s += min(A, K) * 1
    K = max(K - A, 0)
    s += min(B, K) * 0
    K = max(K - B, 0)
    s += min(C, K) * -1
    print(s)
if __name__ == "__main__":
    main()


Measured memory_bytes: 9180
#include<bits/stdc++.h>
using namespace std;
#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define MOD 1000000007
#define vi vector<int>
#define deb(n) cout<<"[ "#n<<" = "<<n<<" ]"<<endl;
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const long long  MAX = 1 << 18;
int case_no=1;
#define w(x) int x; cin>>x; while(x--)

int main() {
	FIO
	long long n;
	int k = 0;
	string ans = "";
	cin >> n;
	while(n != 0) {
		n--;
		ans += (n % 26) + 97;
		n /= 26;
	}
	reverse(ans.begin(), ans.end());
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>

#define pb push_back
#define ll long long

using namespace std;

int main() {
    int l;
    cin >> l;
    double ans = (l*l)*l;
    ans /= 27.0;
    cout << fixed << setprecision(6) << ans << '\n';
    return 0;
}


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

long int factorial(long int n)
{
  if (n == 0)
    return 1;
  else
    return  (n * factorial(n-1)) % MOD;
}

int main()
{
  long int N, M;
  cin >> N >> M;
  if (N == M + 1 || N + 1 == M) {
    long int ans = (factorial(N) * factorial(M)) % MOD;
    cout << ans << endl;
  } else if (N == M) {
    long int ans = (factorial(N) * factorial(M) * 2) % MOD;
    cout << ans << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m,ans;
int main(){
	cin >> n >> m;
	for(int i=1;i<=sqrt(m);i++)
		if(m%i==0){
			if(i<=m/n)ans=max(ans,i);
			if(m/i<=m/n)ans=max(ans,m/i);
		}
	cout << ans;
	return 0;
}

Measured memory_bytes: 384