akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

using ll = long long;

ll X, Y, Z;

int main()
{
  std::cin >> X >> Y >> Z;

  std::swap( X, Y );
  std::swap( X, Z );

  std::cout << X << ' ' << Y << ' ' << Z << std::endl;

  return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <string>
using namespace std;
int main() {
    int N, ans = 0;
    string S;
    cin >> N >> S;
    for (int i = 0; i <= N - 3; i++) {
        if (S.substr(i, 3) == "ABC") ans++;
    }
    cout << ans << endl;
}


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

const int INF = 110000;

int main() {
  int n, x, sum = 0, num = INF;
  int ans = 0;
  int a[1001];
  cin >> n >> x;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
    if (num > a[i]) {
      num = a[i];
    }
  }
  x -= sum;
  while (x >= 0) {
    x -= num;
    ans++;
  }
  cout << (n - 1) + ans << endl;
}


Measured memory_bytes: 256
def cmb(n, r, p):
    r = min(r, n - r)
    res = 1
    for i in range(r):
        res *= pow(i+1, p-2, p)
        res *= n-i
        res %= p
    return res

p = 10 ** 9 + 7
n, a, b = map(int, input().split())
ans = pow(2, n, p) - 1
ans -= cmb(n, a, p) + cmb(n, b, p)
print(ans % p)


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
#include <cstdio>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main()
{
   int i,j,k,l;
   char e[12] = {0};
   char f[10000];
   char m1;

   for(i=0; fgets(e,15,stdin) != NULL; i++) {
      e[10] = 0;
      while(e[1]) {
         for(j=1; e[j]; j++) {
            e[j-1] = (e[j]-'0'+e[j-1]-'0') % 10 + '0';
         }
         e[j-1] = 0;
      }
      f[i] = e[0];
   }
   m1 = i;
   for(i=0;i<m1;i++)
      printf("%c\n",f[i]);
   return 0;
}

Measured memory_bytes: 1116
object Main extends App {
  import scala.io.StdIn._

  val Array(n, m) = readLine.trim.split(' ').map(_.toInt)
  val students = List.tabulate(n){_ ⇒ readLine.trim.toInt}
  (1 to m).foldLeft(students){case (s, b) ⇒ swappingBibs(s, b)}.foreach(println(_))
  def swappingBibs(students: List[Int], baton: Int): List[Int] = {
    students match {
      case Nil ⇒ Nil
      case a::b::t if a % baton > b % baton ⇒ b::swappingBibs(a::t, baton)
      case h::t ⇒ h::swappingBibs(t, baton)
    }
  }
  implicit class ScopeFunc[T](value: T){
    def let[A](func: T ⇒ A): A = func(value)
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
  }
}


Measured memory_bytes: 45124
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define endl "\n"
#define fcout cout<<fixed<<setprecision(15)
typedef pair<int, int> P;
struct edge { int to, cost; };

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

bool prime(int n) {
    for (int i = 2; i <= sqrt(n); i++) {
        if (n % i == 0)return false;
    }
    return n != 1;
}
int gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
int lcm(int x, int y) {
return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
    if (p == 0) return 1;
    if (p % 2 == 0) {
        int t = mod_pow(n, p / 2, m);
        return (t * t) % m;
    }
    return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a % b, y, x);
    y -= a / b * x;
    return d;
}
int modinv(int a, int m) {
    int b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int modinv2(int a, int mod) {
    return mod_pow(a, mod - 2, mod);
}
int digit(int x) {
    int cnt = 0;
    while (x > 0) {
        cnt += x % 10;
        x /= 10;
    }
    return cnt;
}
int read() {
    int tmp;
    cin >> tmp;
    return tmp;
}
int xor128() {
    static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    int t = (x xor (x << 11));
    x = y; y = z; z = w;
    return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
    map<int, int>ans;
    int now = 2;
    while (now * now <= x) {
        if (x % now == 0) {
            x /= now;
            ans[now]++;
        }
        else now++;
    }
    if (x != 1) ans[x]++;
    return ans;
}
int comb(int n, int k, int mod) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    k = min(k, n - k);
    int x = 1, y = 1;
    rep(i, k) {
        y *= i + 1;
        y %= mod;
    }
    for (int i = n - k + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }
    return x * modinv(y, mod) % mod;
}

string s;
int dp[2][2025];

signed main() {
    //srand((unsigned)time(NULL));

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    cin >> s;
    rep(i, 2) {
        rep(j, 2019) {
            dp[i][j] = 0;
        }
    }
    int ans = 0;
    dp[0][0] = 1;
    rep(i, s.size()) {
        rep(j, 2019) {
            int next = (j * 10 + s[i] - '0') % 2019;
            dp[1][next] += dp[0][j];
        }
        rep(j, 2019) {
            dp[0][j] = dp[1][j];
            dp[1][j] = 0;
        }
        ans += dp[0][0];
        dp[0][0]++;
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3804
// In the name of Allah the Lord of the Worlds.

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
ll MOD = 1000000007;
ll ar[100005] , dp[100005];
int n , m;

ll f(int now)
{
    if(now==n)return 1;
    if(now>n)return 0;
    if(ar[now]==1)return 0;
    if(dp[now]!=-1)return dp[now];
    ll value = f(now+1);
    value+=f(now+2);
    return dp[now] = value%MOD;
}

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

    cin >> n >> m;
    for(int i=0;i<m;i++){
        int in;
        cin >> in;
        ar[in] = 1;
    }
    memset(dp , -1 , sizeof(dp));
    cout << f(0) << endl;

    return 0;
}


Measured memory_bytes: 4864
n, m = map(int, input().split())
nlist = list(map(int, input().split()))
nlist = sorted(nlist, reverse = True)

flag = 1

lim = 1/(m*4)*sum(nlist)

for i in range(m):
    if nlist[i] >= lim:
        pass
    else:
        flag = 0
        
if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9188
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.NoSuchElementException;
import java.io.InputStream;

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

    static class BBishop {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long h = in.nextLong();
            long w = in.nextLong();
            long ret = h * w % 2 == 0 ? h * w / 2 : h * w / 2 + 1;
            if (h == 1 || w == 1) {
                out.println(1);
            } else {
                out.println(ret);
            }
        }

    }

    static class Scanner {
        private final InputStream in;
        private final byte[] buffer;
        private int ptr;
        private int buflen;

        public Scanner(InputStream in) {
            this.in = in;
            this.buffer = new byte[1024];
            this.ptr = 0;
            this.buflen = 0;
        }

        private boolean hasNextByte() {
            if (ptr < buflen) return true;
            else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) return false;
            }
            return true;
        }

        private byte readByte() {
            if (hasNextByte()) return buffer[ptr++];
            return -1;
        }

        private boolean isPrintableChar(byte c) {
            return '!' <= c && c <= '~';
        }

        private void skipUnprintable() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
                ptr++;
            }
        }

        public boolean hasNext() {
            skipUnprintable();
            return hasNextByte();
        }

        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            byte b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

    }
}



Measured memory_bytes: 21332
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int n;
    vector<int> R(200000);

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

    int minv = R[0];
    int maxv = R[1] - R[0];

    for (int i = 1; i < n; i++) {
        maxv = max(maxv,R[i] - minv);
        minv = min(R[i],minv);
    }
    cout << maxv << endl;
    return 0;
}


Measured memory_bytes: 3464
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Vec  =vector<int>;
using Graph = vector<vector<P>>;

Vec ans;
Graph G;

int		Xor(int n)
{
	if (n)
		return (0);
	return (1);
}

void	dfs(int top)
{
	for (auto i = G.at(top).begin(); i != G.at(top).end(); i++)
	{
		if (ans.at(i->first) != -1)
			continue ;
		if (i->second % 2)
			ans.at(i->first) = Xor(ans.at(top));
		else
			ans.at(i->first) = ans.at(top);
		dfs(i->first);
	}
}

int		main(void)
{
	int n;
	cin >> n;
	G = Graph(n + 1);
	for (int i = 0; i < n - 1; i++)
	{
		int u, v, w;
		cin >> u >> v >> w;
		G.at(u).push_back(P(v,w));
		G.at(v).push_back(P(u,w));
	}
	ans = Vec(n + 1, -1);
	ans.at(1) = 0;
	dfs(1);
	for (auto i = ans.begin(); i != ans.end(); i++)
	{
		if (i == ans.begin())
			continue ;
		cout << *i << endl;
	}
}


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

int main(){

  ll K=0;
  cin>>K;
  
  queue<long long> que;
  
  rep(i,9){que.push(i+1);}
  
  ll get=0;
  rep(i,K){

    get=que.front();
    que.pop();

    int d=get%10;
    for(int l=-1;l<=1;l++){
    	
      int j=d+l;
      if(j<0 || j>9)continue;
      que.push(get*10+j);
  	}
  }


  cout<<get<<endl;
  
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int soba[][2] = {
	{200, 380},
	{300, 550},
	{500, 850}
};

int main() {
	int n, m = 5000 * 500;
	cin >> n;
	if (n == 0){
		return 0;
	}
	for (int i = n / soba[2][0] + 100; i >= 0; i--) {
		for (int j = n / soba[1][0] + 100; j >= 0; j--) {
			for (int k = n / soba[0][0] + 100; k >= 0; k--) {
				int w = i * soba[2][0] + j * soba[1][0] + k * soba[0][0];
				if (w == n) {
					int p = (i / 3 * 3 * soba[2][1] * 0.88) + (i % 3 * soba[2][1]) + (j / 4 * 4 * soba[1][1] * 0.85) + (j % 4 * soba[1][1]) + (k / 5 * 5 * soba[0][1] * 0.8) + (k % 5 * soba[0][1]);
					if (p < m) {
						m = p;
					}
				}
			}
		}
	}
	cout << m << endl;
	return main();
}

Measured memory_bytes: 1164
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <forward_list>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const ll MOD = 1E+09 + 7;
const ll INF = 1E18;
const int MAX_N = 1E+05;

int N, K;

int H[MAX_N], dp[MAX_N];

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

    cin >> N >> K;

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

    dp[0] = 0;
    for (int i = 1; i < N; i++) {
        int cmin = 1E+09;
        for (int j = max(0, i - K); j <= i - 1; j++) {
            cmin = min(cmin, dp[j] + abs(H[i] - H[j]));
        }
        dp[i] = cmin;
    }


    cout << dp[N - 1] << "\n";

    return 0;
}

Measured memory_bytes: 4396
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
using namespace std;

class union_find {
public:
    union_find(int n)
        : par_(n, -1)
    {}
    void init(int n) {
        par_.assign(n, -1);
    }

    int root(int x) {
        return par_[x] < 0 ? x : par_[x] = root(par_[x]);
    }

    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if(x == y) {
            return false;
        } else {
            if(par_[x] < par_[y]) { // size(x) > size(y)
                par_[x] += par_[y];
                par_[y] = x;
            } else {
                par_[y] += par_[x];
                par_[x] = y;
            }
            return true;
        }
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    int size(int x) {
        return -par_[root(x)];
    }

private:
    std::vector<int> par_;
};

using weight = double;

struct edge {
    int from, to;
    weight cost;
    bool operator<(edge const& rhs) const {
        return cost < rhs.cost;
    }
};

using edges = std::vector<edge>;

constexpr double eps = 1e-8;

double dist(double x1, double y1, double z1, double x2, double y2, double z2) {
    return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) + (z1-z2)*(z1-z2));
}

int main() {
    int n;
    while(cin >> n, n) {
        vector<double> x(n), y(n), z(n), r(n);
        for(int i=0; i<n; ++i) {
            cin >> x[i] >> y[i] >> z[i] >> r[i];
        }
        edges es;
        union_find uf(n);
        for(int i=0; i<n; ++i) {
            for(int j=i+1; j<n; ++j) {
                double d = dist(x[i], y[i], z[i], x[j], y[j], z[j]);
                if(d > r[i] + r[j] + eps) {
                    es.push_back((edge){i, j, d - r[i] - r[j]});
                } else {
                    uf.unite(i, j);
                }
            }
        }
        sort(es.begin(), es.end());
        double res = 0;
        for(int i=0; i<es.size(); ++i) {
            edge e = es[i];
            if(!uf.same(e.from, e.to)) {
                uf.unite(e.from, e.to);
                res += e.cost;
            }
        }
        cout << fixed << setprecision(3) << res << endl;
    }
}


Measured memory_bytes: 3332
#include<stdio.h>

int main() {
   int A, B, C;

   scanf("%d %d %d", &A, &B, &C);
   if(A == B && B == C && A == C) {
      printf("No\n");

   }else if(A != B && B != C && A != C) {
      printf("No\n");

   }else {
      printf("Yes\n");

   }
   return 0;
}



Measured memory_bytes: 1656
n,l=map(int,input().split())
a=list(map(int,input().split()))
f=-1
for i in range(n-1):
	if a[i]+a[i+1]>=l:
		f=i
		break
if f==-1:
	print("Impossible")
	exit()
print("Possible")
for i in range(n-1):
	if i<f:
		print(i+1)
	elif i>f:
		print(n-i+f)
print(f+1)

Measured memory_bytes: 20004
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
int main() {
  int a[4];
  rep(i, 4) cin >> a[i];
  sort(a, a + 4);
  if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>

using namespace std;

long long ret = 0;

void solve(long long a, long long b)
{
    if (b == 0) {
        ret -= a;
        return;
    }
    ret += a / b * b * 2;
    solve(b, a % b);
}

void solve()
{
    long long n, x;
    cin >> n >> x;
    solve(n - x, x);
    cout << ret + n << endl;
}

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


Measured memory_bytes: 256
n, m = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(m)]

l = [list(x) for x in zip(*l)]

flag = True
num = [-1] * n
for i in range(m):
    if num[l[0][i]-1] == -1:
        num[l[0][i]-1] = l[1][i]
    elif num[l[0][i]-1] != l[1][i]:
        flag = False

if n != 1:
    if num[0] == 0:
        flag = False
    elif num[0] == -1:
        num[0] = 1

ans = ""
if flag:
    for i in range(n):
        ans += str(max(0, num[i]))

print(ans) if flag else print(-1)


Measured memory_bytes: 3064
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int n, m;
    scan(n, m);
    auto a = readln.split.to!(int[]);

    a.sort!"a > b"();

    auto c = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6];

    auto dp = new string[](n + 1);
    dp[] = null;
    dp[0] = "";

    foreach (i ; 1 .. n + 1) {
        foreach (ai ; a) {
            if (i - c[ai] < 0 || !dp[i - c[ai]]) continue;
            auto s = ('0' + ai).to!char ~ dp[i - c[ai]];
            if (dp[i].length < s.length || dp[i] < s) {
                dp[i] = s;
            }
        }
    }

    debug {
        writeln(dp);
    }

    writeln(dp[n]);
}








void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    ll x1 = a * 60 + b;
    ll x2 = c * 60 + d;
    ll ans = x2 - x1 - e;
    ans = max(ans, 0ll);
    cout << ans << "\n";
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

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

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	int n, m;
	vector<string> s, t;
	cin >> n;
	s.resize(n);
	rep(i, n) cin >> s[i];
	cin >> m;
	t.resize(m);
	rep(i, m) cin >> t[i];

	map<string, int> sm, tm;
	rep(i, n) sm[s[i]]++;
	rep(i, n) tm[s[i]] = 0;
	rep(i, m) tm[t[i]]++;

	int ans = 0;
	rep(i, n)
	{
		chmax(ans, sm[s[i]] - tm[s[i]]);
	}
	cout << ans << endl;
	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);
    String s=sc.next();
    if(s.equals("ABC")) {
    	System.out.println("ARC");
    }else {
    	System.out.println("ABC");
    }
  }
}


Measured memory_bytes: 35684
n=int(input())

goukei=n*(n+1)*(1/2)
a=n//3
goukei-=3*(a)+3*a*(a-1)*(1/2)
b=n//5
goukei-=5*(b)+5*b*(b-1)*(1/2)
c=n//15
goukei+=15*(c)+15*c*(c-1)*(1/2)

print(int(goukei))

Measured memory_bytes: 9192
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int main() {
	int n;
	cin >> n;
	string s, t;
	cin >> s >> t;
	ll ans = 1;
	int prev = -1;
	rep(i,n) {
		if (prev == -1) {
			if (s[i] == t[i]){
				ans = 3;
				prev = 0;
			}
			else {
				ans = 6;
				prev = 1;
				i++;
			}
		} else if (prev == 0) {
			if (s[i] == t[i]){
				ans *= 2;
				prev = 0;
			}
			else {
				ans *= 2;
				prev = 1;
				i++;
			}
		} else {
			if (s[i] == t[i]){
				ans *= 1;
				prev = 0;
			}
			else {
				ans *= 3;
				prev = 1;
				i++;
			}
		}
		ans %= MOD;
	}
	cout << ans << endl;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
using ll = long long;

int main(){
  int n;
  cin >> n;
  ll x;
  cin >> x;
  vector<ll> a(n);
  rep(i,n)cin >> a.at(i);
  vector<ll> c;
  c = a;
  reverse(c.begin(),c.end());
  ll res1=0,res2=0;
  rep(i,n-1){
    if(a.at(i)>x){
      res1+=(a.at(i)-x);
      a.at(i)=x;
    }
    if(a.at(i)+a.at(i+1)>x){
      res1+=(a.at(i)+a.at(i+1)-x);
      a.at(i+1) = x-a.at(i);
    }
    if(c.at(i)>x){
      res2+=(c.at(i)-x);
      c.at(i)=x;
    }
    if(c.at(i)+c.at(i+1)>x){
      res2+=(c.at(i)+c.at(i+1)-x);
      c.at(i+1) = x-c.at(i);
    }
  }
  cout<<min(res1,res2)<<endl;
  return 0;
}


Measured memory_bytes: 1792
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int n;
    scan(n);

    auto a = readln.split.to!(long[]);
    auto b = readln.split.to!(long[]);

    long asum = a.sum();
    long bsum = b.sum();

    if (asum < bsum) {
        writeln(-1);
        return;
    }

    int cntles;
    long sumles;
    long[] ovs;

    foreach (i ; 0 .. n) {
        if (a[i] < b[i]) {
            cntles++;
            sumles += b[i] - a[i];
        }
        else {
            ovs ~= a[i] - b[i];
        }
    }

    ovs.sort!"a > b"();

    int ans = cntles;

    foreach (ov ; ovs) {
        if (sumles <= 0) {
            break;
        }
        ans++;
        sumles -= ov;
    }

    writeln(ans);
}





void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg ; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg ; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

long powmod(long x, long y, long mod = 1_000_000_007L) {
    long res = 1L;

    while (y > 0) {
        if (y & 1) {
            (res *= x) %= mod;
        }
        (x *= x) %= mod;
        y >>= 1;
    }

    return res;
}

Measured memory_bytes: 10060
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

const int mod = 1000000007;

struct mint {
    long long x;
    mint(long long x=0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    cin >> n;
    vi l(n), r(n);
    rep(i, n) cin >> l[i];
    rep(i, n) cin >> r[i];
    vi h(n);
    vb settle(n);
    rep(i, n) {
        h[i] = l[i];
        if (i == 0 || l[i-1] < l[i] || l[i] == 1) {
            settle[i] = true;
        }
    }
    for (int i = n-1; i >= 0; --i) {
        if (settle[i]) {
            if (h[i] > r[i]) {
                puts("0");
                return 0;
            }
        }
        chmin(h[i], r[i]);
        if (i == n-1 || r[i] > r[i+1] || r[i] == 1) {
            settle[i] = true;
        }
    }
    mint ans = 1;
    rep(i, n) {
        if (settle[i]) continue;
        ans *= h[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 1408
package main
import (
   "fmt"
   "os"
   "bufio"
   "strconv"
)
var sc = bufio.NewScanner(os.Stdin)

func main() {
  sc.Split(bufio.ScanWords)
  for {
    first := nextInt()
    second := nextInt()
    if first == 0 && second == 0 {
     break
    }

    if first <= second {
     fmt.Println(strconv.Itoa(first) +" " + strconv.Itoa(second))
    } else if first > second {
     fmt.Println(strconv.Itoa(second) +" " + strconv.Itoa(first))
    }
  }
}


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


Measured memory_bytes: 1192
import java.util.*;
import java.math.*;

class Main{
public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   String s = sc.next();
   if (s.charAt(4) == (s.charAt(5))&& s.charAt(2) == (s.charAt(3))){
    System.out.println("Yes"); 
   }else System.out.println("No"); 
}
}


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

typedef long double ld;
typedef long long ll;

const int N=6,M=400;

ll f[M][1<<N];

int n,a[N],L,b[N];

ll calc(int*a,int L){
	memset(f,0,sizeof f);
	f[a[n]][0]=1;
	for(int i=0;i<L;++i){
		for(int j=0;j<n;++j)
			for(int k=0;k<(1<<n);++k)if(!(k>>j&1)){
				int rg=min(L,i+a[j]);
				for(int l=rg;l<=L;++l)f[l][k|(1<<j)]+=f[l][k];
				for(int l=i;l<rg;++l)f[rg][k|(1<<j)]+=f[l][k];
			}
	}
	return f[L][(1<<n)-1];
}
ld ans;
int main(){
	cin>>n>>L;
	for(int i=0;i<n;++i)cin>>a[i];
	sort(a,a+n);--n;
	for(int i=1;i<=n+1;++i){
		for(int j=0;j<=n;++j)b[j]=a[j]*i;
		ld ret=calc(b,L*i);
		for(int j=1;j<=n+1;++j)if(i!=j)ret/=i-j;
		ans+=ret;
	}
	for(int i=0;i<n;++i)ans/=L;
	cout<<setprecision(18)<<ans<<endl;
	return 0;
}


Measured memory_bytes: 384
N = input()
a = map(int, raw_input().split())
numbers = {}
for i in range(N):
    numbers[a[i]] = numbers.get(a[i], 0) + 1
ans = 0
for k, v in numbers.items():
    if k < v:
        ans += v - k
    elif k > v:
        ans += v
print ans

Measured memory_bytes: 22724
#include <bits/stdc++.h>
typedef long long LL;
using namespace std;
const int mod=1e9+7,N=2e3+50;
inline int add(int x,int y) {return (x+y>=mod)?(x+y-mod):(x+y);}
inline int mul(int x,int y) {return (LL)x*y%mod;}
inline int power(int a,int b) {
	int rs=1;
	for(;b;b>>=1,a=mul(a,a)) if(b&1) rs=mul(rs,a);
	return rs;
}
int n,k,dp[N][N],fac[N*N*2],ifac[N*N*2];
inline int C(int x,int y) {return mul(ifac[x-y],mul(fac[x],ifac[y]));}
int main() {
	cin>>n>>k; int l=2*n*k;
	if(k==1) {puts("1"); return 0;}
	fac[0]=1;
	for(int i=1;i<=l;i++) fac[i]=mul(fac[i-1],i);
	ifac[l]=power(fac[l],mod-2);
	for(int i=l-1;~i;i--) ifac[i]=mul(ifac[i+1],i+1);
	dp[0][0]=1;
	for(int i=1;i<=n;i++)
		for(int j=0;j<=i;j++) {
			if(j==i) dp[i][j]=dp[i][j-1];
			else dp[i][j]=add(dp[i][j-1],mul(dp[i-1][j],C(k-2+(i-1)*k-(i-j-1),k-2)));
		}
	printf("%d\n",mul(dp[n][n],fac[n]));
}

Measured memory_bytes: 82176
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()



def main():
	n=RD()
	x=0

	for i in n:
		x+=int(i)
		x%=9

	ans="No"
	if x==0:
		ans="Yes"

	print(ans)





if __name__ == "__main__":
	main()


Measured memory_bytes: 68260
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<signed(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const ll INF = 20000000000;
struct edge {int to,cost;};
#define VMAX 51
//typedef std::pair<int,int> P;

    ll N,X,A[100001],ans;
int main(){
    ios_base::sync_with_stdio(false);
    cin>>N>>X;
    REP(i,N)cin>>A[i];
    REP(i,N-1){
        if(A[i]+A[i+1]>X){
            ll B=A[i]+A[i+1];
            if(A[i+1]-(B-X)<0)A[i+1]=0;
            else A[i+1]-=(B-X);
            ans+=(B-X);
        }
    }

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

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<functional>
using namespace std;
int main(void) {
    

    int x;
    cin>>x;
    int a,b,c,d;
    d=x%10;
    c=x/10%10;
    b=x/100%10;
    a=x/1000;
    int sum=0;
    
    if(a+b+c+d==7){
        cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
        return 0;
    }else if(a+b+c-d==7){
        cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
        return 0;
    }else if(a+b-c+d==7){
        cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
        return 0;
    }else if(a+b-c-d==7){
        cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
        return 0;
    }else if(a-b+c+d==7){
        cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
        return 0;
    }else if(a-b+c-d==7){
        cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
        return 0;
    }else if(a-b-c+d==7){
        cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
        return 0;
    }else {
        cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
        return 0;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  ll n;
  cin >> n;

  ll ans = 0;
  rep(i, n + 1) {
    if (i % 3 != 0 && i % 5 != 0) {
      ans += i;
    }
  }
  cout << ans << endl;
  

  
  return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define ll       long long
#define DS       pair<ll, ll>
#define READ(f)  freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

const int N = 2e5 + 5;
const int MOD = 1e9 + 7;;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll red[N], green[N], col[N];

int main() {
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    for (int i = 0; i < a; i++) {
        cin >> red[i];
    }
    for (int i = 0; i < b; i++) {
        cin >> green[i];
    }
    for (int i = 0; i < c; i++) {
        cin >> col[i];
    }
    sort(col, col + c, greater<int>());
    sort(red, red + a, greater<int>());
    sort(green, green + b, greater<int>());
    int rCnt = x, gCnt = y, cCnt = 0;
    for (int i = 0; i < c; i++) {
        if (rCnt && gCnt) {
            if (col[i] > red[rCnt - 1] && col[i] > green[gCnt - 1]) {
                if (red[rCnt - 1] < green[gCnt - 1]) {
                    rCnt--;
                } else {
                    gCnt--;
                }
                cCnt++;
            } else if (col[i] > red[rCnt - 1]) {
                rCnt--;
                cCnt++;
            } else if (col[i] > green[gCnt - 1]) {
                gCnt--;
                cCnt++;
            } else {
                break;
            }
        } else if (rCnt) {
            if (col[i] > red[rCnt - 1]) {
                rCnt--;
                cCnt++;
            } else {
                break;
            }
        } else if (gCnt) {
            if (col[i] > green[gCnt - 1]) {
                gCnt--;
                cCnt++;
            } else {
                break;
            }
        } else {
            break;
        }
    }
    ll ans = 0;
    if (rCnt) {
        for (int i = 0; i < rCnt; i++) {
            ans += red[i];
        }
    }
    if (gCnt) {
        for (int i = 0; i < gCnt; i++) {
            ans += green[i];
        }
    }
    if (cCnt) {
        for (int i = 0; i < cCnt; i++) {
            ans += col[i];
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define FOR(a, c) for (int(a) = 0; (a) < (c); (a)++)
#define FORL(a, b, c) for (int(a) = (b); (a) <= (c); (a)++)
#define FORR(a, b, c) for (int(a) = (b); (a) >= (c); (a)--)
#define INF 1000000000000000003
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define F first
#define S second
#define pb push_back 
#define pob pop_back
#define mp make_pair

void solve(){
	int n;
	cin>>n;
	int a[n];
	int sum=0;
	FOR(i,n){
	  cin>>a[i];
	  sum += a[i];
	}
	int MINI=1e9;
	int sum1=0;
	FOR(i,n){
		sum1+=a[i];
		MINI = min(MINI, abs(sum1 - (sum-sum1)));
	}
	cout<<MINI;

}

int main(){

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    while(t--){
      solve();
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
long long mod = 1000000007;
const int INF = 1001001001;

int main(){
  int n,k; cin>>n>>k;
  if(k%2 == 0){
    int a = (n/(k/2))/2;
    int b = (n/(k/2)) - a;
    cout << (ll)(pow(a,3) + pow(b,3)) << endl;
  }else{
    cout << (ll)(pow(n/k,3)) << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<map>
#include<deque>
#include<string>
#include<algorithm>
#include<bitset>
typedef long long ll;

#define all(x) (x).begin(),(x).end()
#define puts(x) cout<< x << endl;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define fore(i,a) for(auto i:a)
#define MOD 1000000007;
using namespace std;
int a,b,c;
int main(){
    cin>>a>>b>>c;
    int temp=c;
    c=b;
    b=a;
    a=temp;
    cout<<a<<" "<<b<<" "<<c<<endl;
}  


Measured memory_bytes: 256
// ----- In the name of ALLAH, the Most Gracious, the Most Merciful -----

#include<bits/stdc++.h>
using namespace std;

#define NINJA ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define dloop(i,n) for(int i=n-1;i>=0;i--)
#define iii tuple<int,int,int>
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define int long long
#define ld long double
#define pb push_back
#define endl "\n"
#define setbits __builtin_popcountll
#define mp map<int,int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 1000000007
#define inf (int)1e18

string a[10];
int n,m,k;
vector<vector<int>> aa,bb;



int32_t main(){
	NINJA;

	cin >> n >> m >> k;
	fo(i,n) cin >> a[i];

	int cnt = 0;
	fo(i,n){
		fo(j,m){
			cnt += (a[i][j] == '#' ? 1 : 0);
		}
	}

	// if(cnt == k){
	// 	cout << 1 << endl;
	// 	return 0;
	// }
	
	for(int i=0;i<(1<<n);i++){
		vi b;
		for(int j=0;j<n;j++){
			if((1ll<<j)&i) b.pb(j);
		}
		aa.pb(b);
	}

	for(int i=0;i<(1<<m);i++){
		vi b;
		for(int j=0;j<m;j++){
			if((1ll<<j)&i) b.pb(j);
		}
		bb.pb(b);
	}

	// for(auto i : bb){
	// 	for(auto j : i){
	// 		cout << j << " ";
	// 	}
	// 	cout << endl;
	// }

	int temp[n][m];
	fo(x,n){
		fo(y,m) temp[x][y] = a[x][y];
	}

	int ans = 0;
	for(auto i : aa){

		fo(x,n){
			fo(y,m) a[x][y] = temp[x][y];
		}
		
		int cnt = 0;
		fo(r,sz(i)){
			for(int l=0;l<m;l++){
				a[i[r]][l] = '.';
			}
		}
		int zz[n][m];
		fo(x,n){
			fo(y,m) zz[x][y] = a[x][y];
		}
		int xxx = cnt;
		for(auto j : bb){
			cnt = xxx;
			fo(r,sz(j)){
				for(int l=0;l<n;l++){
					a[l][j[r]] = '.';
				}
			}
			fo(x,n){
				fo(y,m) cnt += (a[x][y] =='#' ? 1 : 0);
			}
			fo(x,n){
				fo(y,m) a[x][y] = zz[x][y];
			}
			// cout << cnt << endl;
			if(cnt == k) ans++;
		}

	}

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

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
ll mod=1e9+7;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll N,K;
	cin>>N>>K;
	bool dp[K+5];
	memset(dp,false,sizeof(dp));
	ll a[N];
	for(ll i=0;i<N;i++)
		cin>>a[i];
	for(ll i=0;i<a[0];i++)
		dp[i]=false;
	dp[a[0]]=true;
	if (N>=2)
	for(ll i=a[0];i<a[1];i++)
	{
		dp[i]=((dp[i-a[0]])==false);
	}
	if (N>=2)
	{
		for(ll i=a[1];i<=K;i++)
		{
			for(ll j=0;j<N;j++)
			{
				if (a[j]<=i)
				{
					dp[i]=dp[i] or (dp[i-a[j]]==false);
				}
			}
		}
	}
	if (dp[K])
		cout<<"First";
	else
		cout<<"Second";
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>

using namespace std;

int main(){
  int N, M; cin >> N >> M;
  vector <int> cnt(N);

  for (int i = 0; i < M; i++){
    int L, R; cin >> L >> R;
    cnt[L - 1]++;
    if (R != N) cnt[R]--;
  }

  int ans = 0;
  if (cnt[0] == M) ans ++;
  for (int i = 1; i < N; i++){
    cnt[i] += cnt[i - 1];
    if (cnt[i] == M) ans ++;
  }
  cout << ans << endl;
  
  return 0;
}


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

using namespace std;

typedef long long ll;
#define fori(a,b,c) for(int a = b;a < int(c);a++)

const int N = 2e6 + 7;
ll n,m,k,cnt,cur,ans;
string str;
bool flag;
vector <ll> v;

int main(){

	char last = 'A';
	cin >> str;
	n = str.size();
	fori(i,0,n){
		if(i == n - 2){
			if(str[i] == last){
				ans++;
				break;
			}
			else{
				if(str[i] == str[i + 1]){
					ans++;
					break;
				}
			}
		}
		if(str[i] != last){
			last = str[i];
			ans++;
		}
		else{
			last = 'A';
			ans++;
			i++;
		}
	}
	
	cout << ans;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <fstream>
using namespace std;

#define MAX (6*N)

class Node
{
public:
	vector<int> to;
	vector<string> sp;
	Node(){}
};

class State
{
public:
	int p;
	string str;
	State(int p, string str)
		:p(p),str(str)
	{}

	bool operator<(const State& s) const
	{
		return str>s.str;
	}
};

int main()
{

	//	ifstream cin("E1.txt");
	//	ofstream cout("out.txt");
	int N,A,S,G;
	while(cin >> N >> A >> S >> G, (N||A||S||G))
	{
		Node node[45];
		for(int i=0; i<A; i++)
		{
			int s,d;
			string str;
			cin >> s >> d >> str;
			node[s].to.push_back(d);
			node[s].sp.push_back(str);
		}

		bool v[40][500]={0};
		priority_queue<State> q;
		q.push(State(S,""));


		bool g=false;
		while(!q.empty())
		{
			State s=q.top(); q.pop();

			if(v[s.p][s.str.size()]) continue;
			v[s.p][s.str.size()]=1;

			if(s.p==G)
			{
				if(s.str.size() > MAX) break;

				g=true;
				cout << s.str << endl;
				break;
			}

			for(int i=0; i<node[s.p].to.size(); i++)
			{
				int next=node[s.p].to[i];
				string spl=node[s.p].sp[i];

				if(s.str.size()+spl.size() > MAX*2) continue;
				if(v[next][s.str.size()+spl.size()]) continue;

				q.push(State(next, s.str+spl));
			}

		}
		if(!g) cout << "NO" << endl;

	}
}

Measured memory_bytes: 4840
/** Author: Dwai
 *  Omae wa mou shindeiru!
**/

#include <bits/stdc++.h>
using namespace std;

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define all(a) (a).begin(),(a).end()
#define fr(i,a,b) for (i = a; i <= b; i++)
#define frr(i,a,b) for (i = a; i >= b; i--)
#define rep(i,n) for (i = 0 ; i < n; i++)
#define repr(i,n) for (i = n - 1; i >= 0; i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define flushinput   cin.ignore(numeric_limits<streamsize>::max(),'\n');

void debug_out() { cerr << endl; }

void clock_out(){
  cerr<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s\n";
}

void fileio(){
  freopen("/home/dwai/Desktop/cp/input.txt","r", stdin);
  freopen("/home/dwai/Desktop/cp/output.txt", "w", stdout);
  freopen("/home/dwai/Desktop/cp/debug.txt", "w", stderr);
}

void ofileio(){
  freopen("input.txt","r", stdin);
  freopen("output.txt", "w", stdout); 
}

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << H;
  debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define fio() fileio()
#define ofio() fileio()
#define clock() clock_out()
#else
#define debug(...) 42
#define fio() 42
#define ofio() ofileio()
#define clock() 42
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<pll> vll;
typedef map<ll,ll> mll;

int IT_MAX = 1 << 20;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

void solve(){
	ll  n,k,q;
	cin>>n>>k>>q;
	ll a[n+1];
	fill(a,a+n+1,k-q);
	ll i;
	rep(i,q)
	{
		ll x;cin>>x;
		a[x]++;
	}	
	fr(i,1,n)
	{
		if(a[i]>0)
		{
			cout<<"Yes\n";
		}
		else cout<<"No\n";
	}
}

int main(){
	//fio();
	fast

	solve();
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>

double manhattan(int n, int* x, int* y, double p)
{
    double sum = 0.0;
    for (int i = 0; i < n; ++i) {
        sum += std::pow(abs(x[i] - y[i]), p);
    }

    return std::pow(sum, 1.0/p);
}

double chebyshev(int n, int*x, int* y)
{
    int max = -1;
    for (int i = 0; i < n; ++i) {
        if (max < abs(x[i] - y[i])) {
            max = abs(x[i] - y[i]);
        }
    }
    return (double)max;
}

int main()
{
    std::size_t n;
    std::cin >> n;

    int x[n] = {};
    for (std::size_t i = 0; i < n; ++i) {
        std::cin >> x[i];
    }

    int y[n] = {};
    for (std::size_t i = 0; i < n; ++i) {
        std::cin >> y[i];
    }

    std::cout << std::fixed << std::setprecision(20) << manhattan(n, x, y, 1.0) << std::endl;
    std::cout << std::fixed << std::setprecision(20) << manhattan(n, x, y, 2.0) << std::endl;
    std::cout << std::fixed << std::setprecision(20) << manhattan(n, x, y, 3.0) << std::endl;
    std::cout << std::fixed << std::setprecision(20) << chebyshev(n, x, y) << std::endl;

    return 0;
}


Measured memory_bytes: 3476
def resolve():
    n = int(input())
    if n == 0:
        return False

    field = []
    def add(a):
        result = 0
        for i in a:
            result += i
        return result

    def mult(a):
        result = 1
        for i in a:
            result *= i
        return result


    op = {"+": add, "*": mult}


    for i in range(n):
        s = input()
        a = [s.count("."), s.replace(".", "")]
        if a[1] not in op:
            a[1] = int(a[1])
        field.append(a)

    values = []
    while field:
        target = field.pop()
        if target[1] not in op:
            values.append(target)
        else:
            operands = []
            for v in values[::-1]:
                if v[0] != target[0] + 1:
                    break
                operands.append(v[1])
                values.remove(v)
            target[1] = op[target[1]](operands)
            values.append(target)
    print(values[0][1])
    return True


while resolve(): pass

Measured memory_bytes: 7628
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define test() ll t;cin>>t;while(t--)
#define MOD 1000000007
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)

int main() {
    SPEED;
    //CODE
	ll n;
	cin>>n;
	ll a[n],b[n],c[n];
	for(ll i=0;i<n;i++) cin>>a[i]>>b[i]>>c[i];
	
	ll dp[n+1][3]={0};
	for(ll i=1;i<=n;i++){
		dp[i][0]=max(dp[i-1][1]+a[i-1],dp[i-1][2]+a[i-1]);
		dp[i][1]=max(dp[i-1][2]+b[i-1],dp[i-1][0]+b[i-1]);
		dp[i][2]=max(dp[i-1][0]+c[i-1],dp[i-1][1]+c[i-1]);
	}
	cout<<max(dp[n][0],max(dp[n][1],dp[n][2]));
	return 0;
}


Measured memory_bytes: 4992