akhauriyash/Code-Regression huggingface dataset:
# frozen_string_literal: true

line = readline.split(' ').map(&:to_i)
(0..2).each do |i|
  (i..2).each do |j|
    next unless line[i] > line[j]

    tmp = line[i]
    line[i] = line[j]
    line[j] = tmp
  end
end
puts line.join(' ')



Measured memory_bytes: 6864
#include <stdio.h>

int main(void) {

	int D;

	scanf("%d", &D);

    if(D == 25){
      puts("Christmas");
    }
    else if(D == 24){
      puts("Christmas Eve");
    }
    else if(D == 23){
      puts("Christmas Eve Eve");
    }
    else{
      puts("Christmas Eve Eve Eve");
    }
  
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <iomanip> 
#include <cstring>
#include <queue>
#include <stack> 
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
int a[100005];
int main(){
	int n;
	scanf("%d",&n);
	int flag = 0;
	for(int i = 1;i <= n;i++){
		scanf("%d",&a[i]);
		if(a[i]&1){
			flag = 1;
		}
	}
	if(flag){
		printf("first\n");
	}else{
		printf("second\n");
	}
	return 0;
}

Measured memory_bytes: 640
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//int→string
//string→int
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//sqrt
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define REPR(i, n) for(int i = n;i >= 0;i--)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


//#define EPS (1e-10)
//
//struct Point{
//    Point(double _x = 0, double _y = 0){
//        x = _x;
//        y = _y;
//    }
//    double x;
//    double y;
//
//    Point operator + (Point p){
//        return Point(x + p.x, y+ p.y);
//    }
//
//    Point operator - (Point p){
//        return Point(x - p.x, y - p.y);
//    }
//
//    Point operator * (double a){
//        return Point(a * x, a * y);
//    }
//
//    Point operator / (double a){
//        return Point(x / a, y / a);
//    }
//
//    double abs(){
//        return sqrt(norm());
//    }
//
//    double norm(){
//        return x * x + y * y;
//    }
//
//    bool operator < (const Point &p) const{
//        return x!=p.x ? x < p.x : y < p.y;
//    }
//
//    bool operator == (const Point &p) const{
//        return fabs(x - p.x) && fabs(y - p.y) < EPS;
//    }
//
//};
//
//typedef Point Vector;
//
//double dot(Vector a, Vector b){
//    return a.x * b.x + a.y * b.y;
//}

int main() {


    int N; scanf("%d", &N);
    int sum = 0;
    int tmp = N;

    while(true){
        sum += tmp %10;
        tmp /= 10;
        if(!tmp){
            break;
        }
    }

    if(N%sum == 0){
        printf("Yes");
    }else{
        printf("No");
    }

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
Graph G;
vector<int> color;
using ll = long long;
// white 0, black 1

bool dfs(int cn, int cn_color){
    color[cn] = cn_color;

    // for (auto next: G[cn]){
    //     if (color[next] != -1) {
    //         if (color[next] == cn_color) return false;
    //         continue;
    //     }
    //     if (!dfs(next, 1 - cn_color)) return false;
    // }
    // return true;

    bool ok = true;
    for (auto next: G[cn]){
        if (color[next] == -1) {
            color[next] = 1 - cn_color;
            if (ok) ok = dfs(next, color[next]);
            continue;
        }
        if (cn_color == color[next]) return false;
        else continue;
    }
    return ok;
}

int main() {
    ll N, M;
    cin >> N >> M;
    G.resize(N);
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    color.assign(N, -1);
    bool is_bipartite = dfs(0, 0);
    ll ans = 0;
    ll B = 0;
    if (is_bipartite) {
        B = count(color.begin(), color.end(), 1);
        ans = B * (N - B) - M;
    }
    else ans = (N - 1) * N / 2 - M;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9400
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double a = 11;
        double n = sc.nextDouble();
        double ans = Math.ceil(n/a)*2;
        if(n%11<7 && n%11!=0) ans--;
        System.out.println((long)ans);
    }
}

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

using namespace std;

const long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}

vector<pair<long long, long long>> events;

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

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

    int n;
    cin >> n;

    for(int i = 0; i < n; ++i){
        long long a, b;
        cin >> a >> b;
        events.push_back(make_pair(b, a));
    }

    sort(events.begin(), events.end());

    long long cur = 0;
    for(auto i : events){
        cur += i.second;
        if(cur > i.first){
            cout << "No";
            return 0;
        }
    }

    cout << "Yes";

    return 0;
}


Measured memory_bytes: 6512
#include <stdio.h>

void swap(int *x, int *y){
	int temp;
	temp = *x;
	*x = *y;
	*y = temp;
}

int main(void){
	int i;
	int lbflag;
	int num[5];
	for(i = 0; i < 5; i++){
		scanf("%d",num+i);
	}
	while(1){
		lbflag = 1;
		for(i = 0; i < 4; i++){
			if(num[i] < num[i+1]){
				swap(num+i, num+i+1);
			}
		}
		for(i = 0; i < 4; i++){
			if(num[i] < num[i+1]){
				lbflag = 0;
				break;
			}
		}
		if(lbflag){break;}
	}
	for(i = 0; i < 5; i++){
		printf("%d",num[i]);
		if(i != 4){putchar(' ');}
	}
	putchar('\n');
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int c1,c5,c10,c50,c100,c500,num;

	cin >> c1 >> c5 >> c10 >> c50 >> c100 >> c500;

	num = c1 + c5 * 5 + c10 * 10 + c50 * 50 + c100 * 100 + c500 * 500;
	if (num >= 1000){
		cout << 1 << endl;
	}

	else cout << 0 << endl;
	

	return 0;
}


Measured memory_bytes: 3104
#include <stdio.h>

int main(void)
{
	char Class[9][16];
	int am, pm;
	int sum[9];
	int money[9];
	int i;
	
	for (i = 0; i < 9; i++){
		scanf("%s%d%d", Class[i], &am, &pm);
		sum[i] = am + pm;
		money[i] = am * 200 + pm * 300;
	}
	
	for (i = 0; i < 9; i++){
		printf("%s %d %d\n", Class[i], sum[i], money[i]);
	}
	
	return (0);
} 

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

#define FOR(i,b,e) for(ll i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(ll i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)

#define pb push_back
#define mp make_pair
#define st first
#define nd second


using namespace std;

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

typedef vector <int> VI;
typedef vector <bool> VB;
typedef vector <pii> VP;
typedef vector <ll> VL;
typedef vector <pll> VPL;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000000000000001LL;

bool isPal(string s) {
    string q = s;
    reverse(q.begin(), q.end());
    
    return s == q;
}

/*************************************************************************/

int main() {
    ios_base::sync_with_stdio(0);
    
    string s;
    cin >> s;
    
    string q;
    for (char c : s) if (c != 'x') {
        q.push_back(c);
    }
    
    if (!isPal(q)) {
        cout << -1;
        return 0;
    }
    
    s = "#" + s + "#";

    int n = SIZE(s);
    int ans = 0;
    
    int r = n-1;
    for (int l = 0; l < r ; l++) if (s[l] != 'x') {
        while (s[r] != s[l]) r--;
        
        if (l < r) {
            int firstLeft = l + 1;
            while (s[firstLeft] == 'x') firstLeft++;
            
            if (firstLeft < r) {
                int firstRight = r - 1;
                while (s[firstRight] == 'x') firstRight--;
                
                int diff = abs((firstLeft - l) - (r - firstRight));
                ans += diff;
            }
        }
        
        r--;
    }
    
    cout << ans;

    return 0;
}

/*************************************************************************/


Measured memory_bytes: 592
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    ll n;
    cin >> n;
    vector<ll> a(3*n);
    rep(i, 3*n)cin >> a[i];

    sort(ALL(a), greater<ll>());

    ll sum = 0;
    rep(i, n*2)if(i&1)sum+=a[i];
    
    cout << sum << endl;

}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define PI 3.1415926535
const long long int MOD = 998244353;
#define pb push_back
#define mp make_pair
#define fill(a)  memset(a, 0, sizeof (a))
#define MAX(v) *max_element(v.begin(), v.end())
#define MIN(v) *min_element(v.begin(), v.end())
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define watch(x) cout << (#x) << " is " << (x) << endl;
const long long int MAXX = 2e5+5;
const long long int MINN = 2e6 + 5;
const long long int inf = 1e9;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector< iii > viii;

ll lcm(ll a, ll b) {
   return a / __gcd(a, b) * b;
}
int XOR(int x, int y){
  return (x | y) & (~x | ~y);
}
bool cmp(const pair<int,int> &a,const pair<int,int> &b) {
    return (a.second < b.second);
}
// bool isl = binary_search(x.begin(), x.end(), 5);
// __builtin_popcount(x)  - Returns the number of set bits in x
const long long int N = 1e7;
const int MAXN = 105;
int binsearch(int lo, int hi){
    while(lo<hi){
        int mid=(lo+hi)/2;
        if((mid))   // check(mid)
            hi=mid;
        else
            lo=mid+1;
    }
    return lo;
}
int power(int x,int y){
    int res=1;
    while(y>0){
      if(y&1) res=((res*x));

      y/=2;
      x=((x*x));
    }
    return res;
}


int main(){
    FAST    
    int l,r,d,cnt=0;
    cin>>l>>r>>d;
    for(int i=l;i<=r;i++){
        if(i%d == 0){
            cnt++;
        }
    }
    cout<<cnt;
    return 0;
}




Measured memory_bytes: 3608
let rec floor_sqrt acc acc_x_2_x_r sq_acc_minus_z r sq_r =
  if r = 0 then acc
  else
    let sq_acc_minus_z' = sq_acc_minus_z + acc_x_2_x_r + sq_r in
    ( if sq_acc_minus_z' <= 0 then
        floor_sqrt (acc + r) ((acc_x_2_x_r lsr 1) + sq_r) sq_acc_minus_z'
      else
        floor_sqrt acc (acc_x_2_x_r lsr 1) sq_acc_minus_z) (r lsr 1) (sq_r lsr 2)
let floor_sqrt z = floor_sqrt 0 0 (~-z) (1 lsl 30) (1 lsl 60)

let ceil_sqrt n =
  let m = floor_sqrt n in
  if n <= m * m then m else m + 1

let () = Scanf.scanf "%d" @@ fun s ->
  let x1 = ceil_sqrt s in
  Printf.printf "0 0 %d %d 1 %d" x1 (x1 * x1 - s) x1



Measured memory_bytes: 384
N = int(input())
X = ["0"] + list(input())


def popcount(x):
    c = 0
    while x > 0:
        if x % 2 == 1:
            c += 1
        x //= 2
    return c


def count(x):
    c = 0
    while x > 0:
        p = popcount(x)
        x %= p
        c += 1
    return c


p0 = X.count("1")
Xp, Xm = 0, 0  # X mod p0+1, X mod p0-1
for i in range(1, N + 1):
    if X[i] == "1":
        Xp += pow(2, N - i, p0 + 1)
Xp %= p0 + 1
if p0 > 1:
    for i in range(1, N + 1):
        if X[i] == "1":
            Xm += pow(2, N - i, p0 - 1)
    Xm %= p0 - 1
else:
    Xm = 0

for i in range(1, N+1):
    if X[i] == "1":
        p1 = p0 - 1
        if p1 == 0:
            print(0)
        else:
            x = (Xm + p1 - pow(2, N-i, p1)) % p1
            print(count(x)+1)
    else:
        p1 = p0 + 1
        x = (Xp + pow(2, N-i, p1)) % p1
        print(count(x)+1)


Measured memory_bytes: 12020
#include "bits/stdc++.h"
using namespace std;
int main(){
    string s;
    cin>>s;
    int i,n=s.length();
    vector<int> v;
    for(i=0;i<n;i++){
        v.push_back(s.at(i)-'0');
        while(v.size()>1){
            if(v.at(v.size()-1)!=v.at(v.size()-2)){
                v.pop_back();
                v.pop_back();
            }
            else break;
        }
    }
    cout << n-v.size() << endl;
    return 0;
}

Measured memory_bytes: 1020
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
s = input()
res = 0
for i in range(n):
    cnt = 0
    d1 = defaultdict(int)
    d2 = defaultdict(int)
    for j in range(0,i):
        d1[s[j]] += 1
    for j in range(i,n):
        d2[s[j]] += 1
    for key in d1.keys():
        if d2[key] > 0:
            cnt += 1
    res = max(res, cnt)
print(res)


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

int main()
{
    string s;
    cin >> s;
    string t = s.substr(0, s.size() - 8);
    cout << t << endl;
    return 0;
}

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

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

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

ll R, C, K;

const ll MAXN = 3002;
ll S[MAXN][MAXN];
ll dp[MAXN][MAXN][4];

int main()
{
    cin >> R >> C >> K;

    rep (i, K)
    {
        ll x, y;
        cin >> x >> y;
        --x;
        --y;

        cin >> S[x][y];
    }

    rep (i, R + 1)
    rep (j, C + 1)
    {
        dp[i][j][0] = 0;
    }

    dp[0][0][0] = 0;
    if (S[0][0] >= 0) { dp[0][0][1] = S[0][0]; }

    ll ans = 0;

    rep (i, R)
    rep (j, C)
    rep (k, 3)
    {
        const auto a = dp[i][j + 1][3] + S[i][j];
        const auto b = dp[i + 1][j][k] + S[i][j];
        const auto c = dp[i + 1][j][k + 1];

        const auto score = max(a, max(b, c));
        dp[i + 1][j + 1][k + 1] = score;
        ans = max(ans, score);
    }

    cout << ans << endl;
}


Measured memory_bytes: 355432
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    ll n,k;
    cin >> n >> k;
    if(k%2==1){
        cout << (n/k)*(n/k)*(n/k) << endl;
        return 0;
    }
    
    ll x=n/k, y=n+k/2;
    y /= k;
    cout << x*x*x+y*y*y << endl;

    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <iostream>
#include <functional>
#include <vector>
#include <stdio.h>
#include <queue>
#include <string.h>
#include <math.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define rep1(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define per1(i,a,n) for (int i=a;i>n;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define endl "\n"
#define pi 3.14159265358979323846264338327950288419716939937510
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res, t;res=1;t=a%c;while(b){if(b & 1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
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;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
// head
ll l,r,d,ans,res,pos;
int main()
{
    //IOS;
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    cin>>l>>r>>d;
    res=d;
    pos=2;
    while(1)
    {
        if(res>r)
        {
            break;
        }
        if(l<=res&&res<=r)
        {
            ans++;
        }
        res=d*pos;
        pos++;
    }
    cout<<ans<<endl;
    return 0;
}
/*

*/


Measured memory_bytes: 3620
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n)  FOR(i,0,(n))


class BChocolate {
public:
	void solve(std::istream& in, std::ostream& out) {
    int n,d,x;
    in >> n >> d >> x;
    vector<int> a(n);
    REP(i,n) in >> a[i];
    int cnt = 0;
    REP(i, n){
      cnt += (d - 1) / a[i] + 1;
    }
    out << cnt + x << endl;
	}
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
	BChocolate solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3632
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;

    ll power(ll a, ll b)    //a is base, b is exponent
    {
        if(b==0)
            return 1;
        if(b==1)
            return a;
        if(b%2 == 1)
            return (power(a,b-1)*a)%mod;
        ll q = power(a,b/2);
        return (q*q)%mod;
    }

    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            ll n,ans;
            cin>>n;
            ans=(power(10,n)-power(9,n)*2ll+power(8,n)+2*mod)%mod;
            cout<<ans<<endl;
        }
        return 0;
    }


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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt();
            var ans = 0D;
            double btc = 380000;
            for (int i = 0; i < N; i++)
            {
                var input = Read().Split(' ').ToArray();
                var x = double.Parse(input[0]);
                var y = input[1];
                if (y == "JPY") ans += x;
                else if (y == "BTC") ans += x * btc;
            }

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 13268
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, b, c = rm()
print((a-c) // (b+c))









Measured memory_bytes: 27192
import java.util.*;

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        long X = sc.nextLong();
        long Y = sc.nextLong();
        sc.close();

        if(X%Y == 0){
            System.out.println(-1);
        } else {
            System.out.println(X);
        }
   }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define SZ(x) int(x.size())
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int a, b;
    cin >> a >> b;
    b = 2*b+1;
    cout << (a+b-1)/b << endl;
}


Measured memory_bytes: 3528
#include <cstdio>
#include <algorithm>

using namespace std;


const int MAX_N = 405;

int n,a[MAX_N];
long long sum[MAX_N],dp[MAX_N][MAX_N];

int main()
{
	scanf("%d",&n);
	for (int i=1; i<=n; i++)
	{
		scanf("%d",a+i);
		sum[i]=sum[i-1]+a[i];
	}
	for (int s=2; s<=n; s++)
		for (int i=1; i+s-1<=n; i++)
		{
			int j=i+s-1;
			dp[i][j]=dp[i+1][j];
			for (int k=i+1; k+1<=j; k++)
				dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]);
			dp[i][j]+=sum[j]-sum[i-1];
		}
	printf("%lld\n",dp[1][n]);
	return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define ll long long
int main(void) {
   ll dp[100000+100][4]={0};
   ll MOD = 1000000007LL;
   char *S = (char *)malloc(100100 * sizeof(char));
   scanf("%s", S); 
   int n = strlen(S);
   int k;
   dp[0][3] = 1;
   for (int i = 0; i < n; i++) {
      if (S[i]=='?') {
        k = 3;
      } else {
        k = 1;
      }
      for (int j = 0; j < k; j++) {
        dp[i+1][0] += dp[i][0]; 
        dp[i+1][1] += dp[i][1];
        dp[i+1][2] += dp[i][2]; 
        dp[i+1][3] += dp[i][3]; 
      }
      if (S[i] == 'A') {
        dp[i+1][0] += dp[i][3];
      } else if (S[i] == 'B') {
        dp[i+1][1] += dp[i][0]; 
      } else if (S[i] == 'C') {
        dp[i+1][2] += dp[i][1];
      } else {
        dp[i+1][0] += dp[i][3];
        dp[i+1][1] += dp[i][0];
        dp[i+1][2] += dp[i][1];
      }
      for (int l = 0; l < 4; l++) {
        if (dp[i+1][l]>MOD) {
           dp[i+1][l] %= MOD;
        }
      }
   }
   printf("%lld\n",dp[n][2]%MOD);
   return 0;
}


Measured memory_bytes: 3328
s=input()
ls=len(s)
a=[0]*ls
nr=j=0
for i in range(ls-1):
    if s[i:i+2]=='RL':j=i
    if s[i:i+2]=='LR' or i==ls-2:
        t=''
        if s[i:i+2]=='LR':t=s[nr:i+1]
        elif i==ls-2:t=s[nr:]
        r=t.count('R')
        l=len(t)-r
        a[j+1]+=r//2-(-l//2)
        a[j]+=l//2-(-r//2)
        nr=i+1
print(*a)

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

int main(){
    int N;
    cin >> N;
    long long res = 0,a = 0,b = 0,c = 0;
    rep(i,N){
        string S;
        cin >> S;
        rep(i,S.length()-1){
            if(S[i] == 'A' && S[i+1] == 'B') res++;
        }
        if(S[0] == 'B' && S[S.length()-1] == 'A'){
            c++;
        }else{
            if(S[S.length()-1] == 'A') a++;
            if(S[0] == 'B') b++;
        }
    }
    if(c > 0){
        cout << res + c + ( a+b == 0 ? -1 : min(a,b))  << endl;
    }else{
        cout << res + min(a,b) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
s = 0
for i in set(a):
    s += c[i] * (c[i] - 1)
for i in a:
    print(int((s - (c[i] * (c[i] - 1)) + ((c[i] - 1) * (c[i] - 2))) / 2))

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

int main( void )
{
	string search_text = "Hoshino";
	string replace_text = "Hoshina";

	int n;
	char c;
	cin >> n;
	cin.get();

	for ( int i = 0; i < n; i++ )
	{
		string text;
		getline( cin, text );

		while ( text.find( search_text ) != string::npos )
		{
			text.replace( text.find( search_text ), replace_text.length(), replace_text );
		}
		cout << text << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
	int ans = 0;
	rep(i, 10) {
		int num; cin >> num;
		ans += num;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3104
#!/usr/bin/env python3
import sys
from collections import deque

def solve(N: int, M: int, G, S: int, T: int):
    S -= 1
    T -= 1
    now = deque([S])
    dist = [0 for _ in range(N * 3)]
    while now:
        p = now.popleft()
        for n in G[p]:
            if dist[n] != 0:
                continue
            dist[n] = dist[p] + 1
            if n == T:
                print(dist[n] // 3)
                exit()
            now.append(n)
    print(-1)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    G = tuple(set() for _ in range(N * 3))
    for _ in range(M):
        u, v = int(next(tokens)) - 1, int(next(tokens))-1
        G[u].add(v + N)
        G[u + N].add(v + 2 * N)
        G[u + 2 * N].add(v)

    S = int(next(tokens))  # type: int
    T = int(next(tokens))  # type: int
    solve(N, M, G, S, T)

if __name__ == '__main__':
    main()


Measured memory_bytes: 93816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e6+23;

int main(){
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	while(b<=a&&k){
		b<<=1;
		k--;
	}
	while(c<=b&&k){
		c<<=1;
		k--;
	}
	puts(b>a&&c>b?"Yes":"No");
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

using Data = ll;
constexpr Data INF = 1e15;

struct SegTreeLazy {
  static const int MAX_DEPTH = 18;
  static const int STsize = 1 << MAX_DEPTH;
  Data data[STsize];
  Data lazy[STsize]; int n;
  SegTreeLazy(void) : n(STsize / 2) {
    for(int i:irange(0,STsize)) {
      data[i]=lazy[i]=INF;
    }
  }
  void upd(int fr, int to, Data val) { upd_sub(fr, to, 2*n-2, 0, n, val); }
  Data min_(int fr, int to) { return min_sub(fr, to, 2*n-2, 0, n); }
 private:
  void upd_sub(int fr, int to, int node, int la, int ra, Data val) {
    if (ra<=fr || to<=la) return;
    if (fr<=la && ra<=to) {
      lazy[node] = min(lazy[node], val);
      data[node] = min(data[node], val);
      return;
    }
    data[node] = min(data[node], val);
    upd_sub(fr, to, (node-n)*2+0, la, (la+ra)/2, val);
    upd_sub(fr, to, (node-n)*2+1, (la+ra)/2, ra, val);
  }
  Data min_sub(int fr, int to, int node, int la, int ra) {
    if (ra<=fr || to<=la) return INF;
    if (fr<=la && ra<=to) return min(data[node], lazy[node]);
    Data res = lazy[node];
    res = min(res, min_sub(fr, to, (node-n)*2+0, la, (la+ra)/2));
    res = min(res, min_sub(fr, to, (node-n)*2+1, (la+ra)/2, ra));
    return res;
  }
};

int main()
{
  int n,m;
  cin>>n>>m;
  vector<tuple<ll,ll,ll>> vt;
  for(int i:irange(0,m)) {
    ll l,r,c;
    cin>>l>>r>>c;
    --l;--r;
    vt.emplace_back(l,r,c);
  }
  boost::sort(vt);
  SegTreeLazy stl;
  stl.upd(0,1,0);
  for(auto t:vt) {
    ll l,r,c;
    tie(l,r,c) = t;
    ll d=stl.min_(l,l+1);
    stl.upd(l,r+1,d+c);
  }
  ll res = stl.min_(n-1,n);
  if (res >= INF) {
    cout<<-1<<endl;
  } else {
    cout<<res<<endl;
  }
  return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> L(1005);
    vector<int> R(1005);
    for (int i = 0; i < n; i++) {
        cin >> L[i] >> R[i];
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans += R[i] - L[i] + 1;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long int ll;
int main()
{
    int n;
    cin>>n;
    ll a[n];
    ll ans=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        ans=ans^a[i];
    }
    ll ele;
    for(int i=0;i<n;i++)
    {
        ele=ans^a[i];
        cout<<ele<<" ";
    }
    cout<<endl;
}


Measured memory_bytes: 5040
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 35000;

int main() {
	int n,m;cin>>n>>m;
	int m2=m;
	bool p[N];
	rep(i,N) p[i]=true;
	p[0]=p[1]=false;
	rep(i,N){
		if(!p[i]) continue;
		for(int j=2*i;j<N;j+=i) p[j]=false;
	}
	int c[N];
	rep(i,N){
		c[i]=0;
		if(!p[i]) continue;
		while(m%i==0) {c[i]++;m/=i;}
	}
	vi v;
	v.push_back(1);
	rep(i,N){
		if(c[i]==0) continue;
		int s=v.size();
		for(int j=0;j<s;j++){
			for(int k=1;k<=c[i];k++){
				v.push_back(v[j]*pow(i,k));
			}
		}
	}
	if(m>1){
		int s=v.size();
		for(int j=0;j<s;j++) v.push_back(v[j]*m);
	}
	sort(v.begin(),v.end());
	int b=1;
	for(auto i:v) if(i>=n) {b=i;break;}
	cout<<m2/b<<endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define reps(i, m, n) for (int i = m; i < n; i++)
#define repr(i, m, n) for (int i = m; i >= n; i--)
#define db(x) cout << #x << "=" << x << endl;
template <class T>
bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
#define EPS 1e(-9);
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
//--GLOBAL---------------------------------


//--MAIN-----------------------------------
void Main() {
    int N;
    cin >>N;

    string S; cin>>S;

    if(N%2==1){
        cout<< "No" <<"\n"; return;
    }

    rep(i,N/2){
        if(S[i]!=S[i+N/2]){
            cout<< "No"<<"\n"; return;
        }
    }

    cout<< "Yes"<<"\n";
}

//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 892
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            cost = 500 * a + 100 * b + 50 * c
            if cost == X:
                ans += 1
print(ans)

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repb(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for(auto v:(V))cout<<v<<" "<<endl
inline ll GCD(ll a, ll b){return b ? GCD(b, a % b) : a;}
const int MOD = 1000000007;

int main()
{
    ll n, k;
    cin >> n >> k;
    cout << n-k+1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,h,w;
	cin>>n>>h>>w;
	int ans=0,a,b;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		if(a>=h&&b>=w) ans++;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
def is_increasing(n):
    for c1,c2 in zip(str(n),str(n)[1:]):
        if int(c1) + 1 != int(c2):
            return False
    return True

N = int(input())
src = list(map(int,input().split()))
ans = -1
for i in range(N-1):
    for j in range(i+1,N):
        if is_increasing(src[i] * src[j]):
            ans = max(ans, src[i] * src[j])
print(ans)

Measured memory_bytes: 5620
#include<stdio.h>

int main(void)
{
	int N,n,M,m=0,A,max=0;
	int i,j;
	int kyougi[1200]={0},kai[1200]={0};
	
	scanf("%d %d",&N,&M);

	for(i=1;i<N+1;i++)  scanf("%d",&kyougi[i]);
	
	for(i=0;i<M;i++){
		scanf("%d",&n);
		j=1;
		while(j!=N+1){
			if(kyougi[j]<=n){
				kai[j]++;
				if(max<kai[j]){
					max=kai[j];
					A=j;
				}
				break;
			}
			j++;
		}
	}
	printf("%d\n",A);
	return 0;
}

Measured memory_bytes: 1036
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

int n;
int main(){
	scanf("%d",&n);
	rep(i,0,n)printf("ACL");
}

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

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define yes(c) cout << ((c) ? "yes" : "no") << endl;
 
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;

int sumd(int i){
  
  int x = 0;
  
  while( i > 0 ){
    x += i % 10;
    i /= 10;
  }
  
  return x;

}

int main() {
  
  int n,a,b;
  cin >> n >> a >> b;
  
  int hantei = 0,goukei = 0;
  
  for ( int i = 1; i <= n; i++){
    hantei = sumd(i);
    if ( hantei >= a && hantei <= b ){
      goukei += i;
    }
  }
  
  cout << goukei << endl;

}

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

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

int A[3][3];
const int N = 11;
int n, t;

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

  unordered_map<int, ii> ma;
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      cin >> t;
      ma[t] = ii(i, j);
    }
  }
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> t;
    if (ma.count(t)) {
      auto p = ma[t];
      int a = p.first, b = p.second;
      A[a][b] = 1;
    }
  }
  bool ok = false;
  for (int i = 0; i < 3; ++i) {
    if (A[i][0] == 1 && A[i][1] == 1 && A[i][2] == 1) {
      ok = true;
      break;
    }
  }
  for (int i = 0; i < 3; ++i) {
    if (A[0][i] == 1 && A[1][i] == 1 && A[2][i] == 1) {
      ok = true;
      break;
    }
  }
  if (A[0][0] == 1 && A[1][1] == 1 && A[2][2] == 1) ok = true;
  if (A[2][0] == 1 && A[1][1] == 1 && A[0][2] == 1) ok = true;
  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=998244353;
const ll mod=998244353;
signed main(){
    ll n;cin>>n;
    vector<ll>now(100010);
    ll ans=0;
    rep(i,n){
        ll a;cin>>a;
        now[a]++;
    }
    rep(i,100010){
        ans+=now[i]*i;
    }
    ll q;cin>>q;
    rep(i,q){
        ll b,c;cin>>b>>c;
        now[c]+=now[b];
        ans=ans-b*now[b]+c*now[b];
        now[b]=0;
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3972
{-# LANGUAGE BangPatterns #-}
import Data.Char
import Data.List
import Control.Monad
import qualified Data.Vector.Unboxed as U
import qualified Data.ByteString.Char8 as BS
import Control.Monad.ST
import Data.Array.ST

asSTUArray :: ST s (STUArray s i a) -> ST s (STUArray s i a)
asSTUArray arr = arr

solve :: Int -> Int -> Int -> Int -> Double
solve !n !b !c !d = runST $ do
  arr <- asSTUArray $ newArray ((-1,-1,-1),(n+1,n+1,n+1)) 0
  writeArray arr (0,0,0) 0
  forM_ [0..d] $ \k -> do
    forM_ [0..c+d-k] $ \j -> do
      -- j + k <= c + d
      forM_ [0..b+c+d-j-k] $ \i -> do
        -- i + j + k <= b + c + d
        when (i + j + k > 0) $ do
          x <- readArray arr (i-1,j,k)
          y <- readArray arr (i+1,j-1,k)
          z <- readArray arr (i,j+1,k-1)
          let t = fromIntegral (i + j + k)
          writeArray arr (i,j,k) $ (fromIntegral n + fromIntegral i * x + fromIntegral j * y + fromIntegral k * z) / t
  readArray arr (b,c,d)

main = do
  n <- readLn
  -- 1 <= n <= 300
  xs <- U.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  -- 1 <= ai <= 3
  let c1 = U.length (U.filter (== 1) xs)
      c2 = U.length (U.filter (== 2) xs)
      c3 = U.length (U.filter (== 3) xs)
  -- c1 + c2 + c3 should be n
  print $ solve n c1 c2 c3


Measured memory_bytes: 219132
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; }                            /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; }                            /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)

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

  int i;
  for (i = 0; i < 10; i++)
  {
    x = r * x - d;
    printf("%d\n", x);
  }
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main()
{
	int A, B, i;
	char S[10];

	scanf("%d %d", &A,&B);
	scanf("%s", S);

	for(i = 0; i < A + B + 1; i++) {
		if(i == A && S[i] != '-' || i != A && S[i] == '-') {
			printf("No");
			break;
		}
		if(i == A + B)
			printf("Yes");
	}

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;


int n, k;

int main(){
	cin >> n >> k;
	
	if(k > (n-1)*(n-2)/2){
		cout << -1 << endl;
		return 0;
	}
	//1,2 1,3 1,4 1,5 2,3 2,4 2,5 3,4 3,5 4,5
	vector<P> ans;
	for(int j = 2; j <= n; j++){
		ans.push_back(P(1,j));
	}
	k -= (n-1)*(n-2)/2;
	for(int i = 2; i < n; i++){
		for(int j = i+1; j <= n; j++){
			if(k >= 0) break;
			ans.push_back(P(i,j));
			k++;
		}
		if(k == 0) break;
	}
	
	cout << ans.size() << endl;
	for(int i = 0; i < ans.size(); i++){
		cout << ans[i].first << " " << ans[i].second << endl;
	}
	
	return 0;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int max = 0;
		for (int i = 0; i < s.length(); i++) {
			for (int j = i; j < s.length(); j++) {
				if (s.charAt(j) == 'A' || s.charAt(j) == 'C' || s.charAt(j) == 'G' || s.charAt(j) == 'T') {
				} else {
					break;
				}
				if (max < j - i + 1) {
					max = j - i + 1;
				}
			}
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 21844
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline
    from collections import Counter

    N = int(input())
    A = list(map(int, input().split()))
    CA = Counter(A)
    sumA = 0
    for key, value in CA.items():
        sumA += key*value

    Q = int(input())
    for i in range(Q):
        b, c = map(int, input().split())
        sumA += (c-b)*CA[b]
        CA[c] += CA[b]
        CA[b] = 0
        print(sumA)

main()

Measured memory_bytes: 24180
n, k, q = map(int, input().split())
a = []
for _ in range(q):
    a.append(int(input()))

# print(n,k,q, a)

points = {i:0 for i in range(n)}

# print(points)
for ai in a:
    points[ai-1] += 1

for i in range(n):
    if k - q + points[i] > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 19088
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
	class Program
	{
		static void Main(string[] args)
		{
			var temp = Console.ReadLine().Split(' ');
			var r = int.Parse(temp[0]);
			var g = int.Parse(temp[1]);
			var b = int.Parse(temp[2]);


			int res = r * 100 + g * 10 + b;
			if (res % 4 == 0)
			{
				Console.WriteLine("YES");
			}
			else
			{
				Console.WriteLine("NO");
			}
			return;
		}
	}
}


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

int main() {

	int a, b, k;
	cin >> a >> b >> k;

	int num = min(a, b);
	int ans = 0;

	while (k > 0) {
		if (a % num == 0 && b % num == 0) {
			ans = num;
			k--;
		}
		num--;
	}

	cout << ans << endl;


	return 0;
}

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

const ll mod = 1e9 + 7;
int N;
ll T[100010], A[100010];
ll t[100010], a[100010];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> T[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  fill_n((ll*)t, 100010, -1);
  fill_n((ll*)a, 100010, -1);
  t[0] = T[0];
  for (int i = 1; i < N; i++) {
    if (T[i] != T[i-1]) t[i] = T[i];
  }
  a[N-1] = A[N-1];
  for (int i = N-2; i >= 0; i--) {
    if (A[i] != A[i+1]) a[i] = A[i];
  }
  for (int i = 0; i < N; i++) {
    if (t[i] == -1 && a[i] == -1) {
      continue;
    } else if (t[i] == -1) {
      if (!(T[i] >= a[i])) {
        cout << 0 << endl;
        return 0;
      }
    } else if (a[i] == -1) {
      if (!(A[i] >= t[i])) {
        cout << 0 << endl;
        return 0;
      }
    } else {
      if (T[i] != A[i]) {
        cout << 0 << endl;
        return 0;
      }
    }
  }
  ll ans = 1;
  for (int i = 0; i < N; i++) {
    if (t[i] == -1 && a[i] == -1) {
      ans *= min(T[i], A[i]);
      ans %= mod;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3328
# coding:utf-8

N = int(input())
A = list(input())
B = list(input())
C = list(input())

def t_count(a, b, c):
    if a == b:
        if a == c:
            return 0
        else:
            return 1
    elif b == c:
        return 1
    elif c == a:
        return 1
    else:
        return 2


counter = 0
for i in range(N):
    counter += t_count(A[i], B[i], C[i])

print(counter)

Measured memory_bytes: 3064
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	k, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return k
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(k int) bool {
		return a[k] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(k int) bool {
		return a[k] > x
	})
	return idx
}

const mod = 998244353

func mpow(n, p int) int {
	ret := 1
	x := n
	for p > 0 {
		if p%2 == 1 {
			ret *= x
			ret %= mod
		}
		x *= x
		x %= mod
		p /= 2
	}
	return ret
}

var fact [maxval]int
var ifact [maxval]int

func nCk(n, k int) int {
	if n < k || k < 0 {
		return 0
	}
	ret := (fact[n] * ifact[k]) % mod
	ret *= ifact[n-k]
	ret %= mod
	return ret
}

const maxval = 220000

func main() {
	sc.Split(bufio.ScanWords)

	fact[0] = 1
	for k := 1; k < maxval; k++ {
		fact[k] = (k * fact[k-1]) % mod
	}
	ifact[maxval-1] = mpow(fact[maxval-1], mod-2)
	for k := maxval - 2; k >= 0; k-- {
		ifact[k] = ((k + 1) * ifact[k+1]) % mod
	}

	N, M, K := getInt(), getInt(), getInt()

	ans := 0
	for k := 0; k <= K; k++ {
		if N < k {
			break
		}
		x := M * mpow(M-1, N-1-k)
		x %= mod
		x *= nCk(N-1, k)
		x %= mod
		ans += x
		ans %= mod
	}

	out(ans)
}


Measured memory_bytes: 5216