akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(ll i=0;i<(n);++i)
#define reps(i,n) for(ll i=1;i<=(n);++i)
#define repr(i,n) for(ll i=(n);i>=0;--i)
#define all(a) a.begin(),a.end()
#define debg(a) cout<<#a<<" "<<a<<endl;
using ll = long long;
using str = string;
using D = double;
using vl = vector<ll>;
using pl = pair<ll,ll>;
using vp = vector<pair<ll,ll>>;
constexpr long long INF = (1LL<<60);
constexpr long long MOD = (1e9+7);
constexpr long long LMAX = LLONG_MAX;
inline void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
inline void dump(){cout<<endl;}
template<class Head,class... Tail>
inline void dump(Head&& head, Tail&&... tail){
  cout<<head<<", ";
  dump(forward<Tail>(tail)...);
} // output
inline void console_input(){}
template<class Head,class... Tail>
inline void console_input(Head&& head, Tail&&... tail){
  cin>>head;
  console_input(forward<Tail>(tail)...);
} // input
template<typename T>
inline ostream &operator<<(ostream&out,const vector<T>&v){
  for(const auto&element:v)out<<element<<", ";
  return out;
} // vector<>
template<typename T1, typename T2>
inline ostream &operator<<(ostream&out,const pair<T1,T2>&p){
  out<<p.first<<", "<<p.second;
  return out;
} // pair<>
template<typename T>
inline ostream &operator<<(ostream&out,const set<T>&st){
  for(const auto&elemnt:st)out<<elemnt<<", ";
  return out;
} // set<>
template<typename T1,typename T2>
inline ostream &operator<<(ostream&out,const vector<pair<T1,T2>>&vp){
  for(const auto &element:vp)
    out<<element.first<<", "<<element.second<<"\n";
  return out;
} // vector<pair<>>
template<typename T1,typename T2>
inline ostream &operator<<(ostream&out,const map<T1,T2>&mp){
  for(const auto &element:mp){
    out<<element.first<<", "<<element.second<<"\n";
  }
  return out;
} // map<>
template<typename T>
inline istream &operator>>(istream&input,vector<T>&v){
  for(auto &elemnt:v)input>>elemnt;
  return input;
} // input,vector<>

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(10);
  
  ll n;
  console_input(n);

  str s="";
  if(n==0)s="0";
  while(n){
    if(n%-2!=0){
      n--;
      s="1"+s;
    }
    else {
      s="0"+s;
    }
    n/=-2;
  }
  cout<<s<<endl;
  
  return 0;
}


Measured memory_bytes: 256
// itp1_3_D
#include <stdio.h>

int main() {
	int a,b,c;
	int t=0;
	scanf("%d %d %d", &a, &b, &c);
	for(int i=a; i<=b; i++){
		if(0==c%i) t++;
	}
	printf("%d\n",t);
	return 0;
}

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

int main(){
  int n; cin>>n;
  int log,m=-1,count=0;
  vector<int> num(n);
  for(int i=0;i<n;i++){
    cin>>num[i];
    if(i==0){
      log=num[i];
    }
    else if(log>=num[i]){
      count++;
      log=num[i];
    }else{
      m=max(count,m);
      count=0;
      log=num[i];
    }
  }m=max(m,count);
  cout<<m<<endl;
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <fstream>

using namespace std;

template<class T> inline T cabs(const T &x) { return x > 0 ? x : (-x); }
template<class T> inline T gcd(const T &x, const T &y) { return (y == 0) ? x : gcd(y, x % y); }
template<class T> inline T sgn(const T &x) { return (x > 0) - (x < 0); }

#define dbg(x) cout << #x << " = " << (x) << endl
#define dbg2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define dbg3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << endl
#define dbg4(x,y,z,w) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << ", " << #w << " = " << w << endl

#define out(x) cout << (x) << endl
#define out2(x,y) cout << (x) << " " << (y) << endl
#define out3(x,y,z) cout << (x) << " " << (y) << " " << (z) << endl
#define out4(x,y,z,w) cout << (x) << " " << (y) << " " << (z) << " " << (w) << endl

const int maxN = 100000 + 10;

int N, M;
int X[maxN];

struct node {
    int val, cnt;
    inline bool operator<(const node &s) const {
        return cnt < s.cnt;
    }
};
node A[maxN]; int nA;

int odd[maxN], even[maxN];

int main()
{
    scanf("%d %d", &N, &M);
    memset(X, 0, sizeof(X));
    int xi;
    for(int i = 0; i < N; i ++) {
        scanf("%d", &xi);
        X[xi] ++;
    }
    nA = 0;
    for(int i = 1; i <= 100000; i ++) {
        if( X[i] ) {
            A[nA].val = i;
            A[nA].cnt = X[i];
            nA ++;
        }
    }
    memset(odd, 0, sizeof(odd));
    memset(even, 0, sizeof(even));
    for(int i = 0; i < nA; i ++) {
        int d = A[i].val % M;
        odd[ d ] += A[i].cnt % 2;
        even[d]  += (A[i].cnt / 2) * 2;
    }
    int ans = 0;
    for(int i = 0; i < M; i ++) {
        int a = i;
        int b = (M - a) % M;
        if( a == b ) {
            ans += odd[a] / 2;
            odd[a] %= 2;
            if( odd[a] ) {
                if( even[a] ) {
                    ans ++;
                    odd[a] --;
                    even[a] --;
                }
            }
        } else {
            int c = min(odd[a], odd[b]);
            ans += c;
            odd[a] -= c, odd[b] -= c;
            if( odd[a] ) {
                if( even[b] ) {
                    c = min(odd[a], even[b]);
                    ans += c;
                    odd[a] -= c, even[b] -= c;
                }
            }
            if( odd[b] ) {
                if( even[a] ) {
                    c = min(odd[b], even[a]);
                    ans += c;
                    odd[b] -= c, even[a] -= c;
                }
            }
        }
    }
    for(int i = 0; i < M; i ++)
        ans += even[i] / 2;
    out(ans);
    return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define filename "deque"
#define int long long
#define N 3005

using namespace std ;

int n , a[N] ;
bool chk[N][N] ;
int f[N][N] ;

void open()
{
    //freopen(filename".inp","r",stdin) ;
    //freopen(filename".out","w",stdout) ;
    ios_base::sync_with_stdio(0) ;
    cin.tie(0) ;
    cout.tie(0) ;
}
void readin()
{
    cin >> n ;
    for (int i = 1 ; i <= n ; i++)
    {
        cin >> a[i] ;
        a[i] += a[i-1] ;
    }
}
int calc(int i ,int j)
{
    if (chk[i][j]) return f[i][j] ;
    if (i > j) return 0 ;
    chk[i][j] = 1 ;
    int &ans = f[i][j] ;
    ans = 0 ;
    ans = max(ans , a[j] - a[i-1] - calc(i+1 , j)) ;
    ans = max(ans , a[j] - a[i-1] - calc(i , j-1)) ;
    return ans ;
}
void process()
{
    cout << 2 * calc(1 , n) - a[n] ;
}
signed main()
{
    open() ;
    readin() ;
    process() ;
}

Measured memory_bytes: 58856
import java.util.Scanner;

public class Main {

	private void solve() {
		Scanner io = new Scanner(System.in);
		int N = io.nextInt();
		int by4 = 0;
		int odd = 0;
		for(int i=0;i<N;i++){
			int a = io.nextInt();
			if(a%2==1){
				odd ++;
			}else if(a%4==0){
				by4 ++;
			}
		}
		System.out.println((odd+by4==N && odd<=by4+1)? "Yes":
							(odd<=by4)?"Yes":"No");
	}

	public static void main(String[] args) {
		new Main().solve();
	}
}

Measured memory_bytes: 48544
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
int a[1000], b[1000], c[1000], d[1000], n, H[2017][2017], h, w; vector<int>X, Y; bool used[2017][2017];
void dfs(int p, int q) {
	if (used[p][q] == true)return; used[p][q] = true;
	int dx[4] = { -1,0,1,0 }, dy[4] = { 0,1,0,-1 };
	for (int i = 0; i < 4; i++) {
		int cx = p + dx[i], cy = q + dy[i];
		if (cx < 0 || cx >= X.size() || cy < 0 || cy >= Y.size())continue;
		if (H[cx][cy] == 1)dfs(cx, cy);
	}
}
int main() {
	while (true) {
		cin >> h >> w; for (int i = 0; i <= n * 2; i++) { for (int j = 0; j <= n * 2; j++) { H[i][j] = 0; used[i][j] = false; } }
		X.clear(); Y.clear(); if (h == 0 && w == 0)break; cin >> n;
		for (int i = 0; i <= n; i++) {
			if (i == n) { a[i] = 0; b[i] = 0; c[i] = h; d[i] = w; }
			else cin >> a[i] >> b[i] >> c[i] >> d[i];
			X.push_back(a[i]); X.push_back(c[i]);
			Y.push_back(b[i]); Y.push_back(d[i]);
		}
		sort(X.begin(), X.end()); X.erase(unique(X.begin(), X.end()), X.end());
		sort(Y.begin(), Y.end()); Y.erase(unique(Y.begin(), Y.end()), Y.end());
		for (int i = 0; i <= n; i++) {
			int pos1 = lower_bound(X.begin(), X.end(), a[i]) - X.begin();
			int pos2 = lower_bound(Y.begin(), Y.end(), b[i]) - Y.begin();
			int pos3 = lower_bound(X.begin(), X.end(), c[i]) - X.begin();
			int pos4 = lower_bound(Y.begin(), Y.end(), d[i]) - Y.begin();
			a[i] = pos1; b[i] = pos2; c[i] = pos3; d[i] = pos4;
			H[a[i]][b[i]]++; H[c[i]][d[i]]++; H[a[i]][d[i]]--; H[c[i]][b[i]]--;
		}
		for (int i = 0; i <= X.size(); i++) {
			for (int j = 1; j <= Y.size(); j++)H[i][j] += H[i][j - 1];
		}
		for (int i = 1; i <= X.size(); i++) {
			for (int j = 0; j <= Y.size(); j++)H[i][j] += H[i - 1][j];
		}
		int ret = 0;
		for (int i = 0; i < X.size(); i++) {
			for (int j = 0; j < Y.size(); j++) {
				if (used[i][j] == false && H[i][j] == 1) { dfs(i, j); ret++; }
			}
		}
		cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 17012
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();

        int n = Integer.parseInt(a + b);
        double d = Math.floor(Math.sqrt((double) n));

        if (n == d * d) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>

enum face {
  TOP,
  FRONT,
  RIGHT,
  LEFT,
  BACK,
  BOTTOM
};

class dice {
  public:
    dice();
    void setDice(int spot, int eye);
    int getSpot(int top);
    void rollNorth();
    void rollSouth();
    void rollEast();
    void rollWest();
    void rollRight();
    void rollLeft();
    std::vector<dice> all_rolls();

    int& operator[] (face f) {return id[f];}
    const int& operator[] (face f) const {return id[f];}
    bool operator==(const dice &b) const {
      const dice &a = *this;
      return a[TOP] == b[TOP] && a[BOTTOM] == b[BOTTOM] &&
             a[FRONT] == b[FRONT] && a[BACK] == b[BACK] &&
             a[LEFT] == b[LEFT] && a[RIGHT] == b[RIGHT];
    }

  private:
    void roll(face a, face b, face c, face d);
    std::vector<int> id;
};

dice::dice() {
  id.resize(6);
}

void dice::setDice(int spot, int eye) {
  switch(eye) {
    case TOP:
      id[TOP] = spot;
      break;
    case BOTTOM:
      id[BOTTOM] = spot;
      break;
    case FRONT:
      id[FRONT] = spot;
      break;
    case BACK:
      id[BACK] = spot;
      break;
    case LEFT:
      id[LEFT] = spot;
      break;
    case RIGHT:
      id[RIGHT] = spot;
      break;
  }
}

int dice::getSpot(int top) {
  return id[top];
}

void dice::rollNorth() {
  roll(TOP, FRONT, BOTTOM, BACK);
}

void dice::rollSouth() {
  roll(TOP, BACK, BOTTOM, FRONT);
}

void dice::rollEast() {
  roll(TOP, LEFT, BOTTOM, RIGHT);
}

void dice::rollWest() {
  roll(TOP, RIGHT, BOTTOM, LEFT);
}

void dice::rollRight() {
  roll(FRONT, LEFT, BACK, RIGHT);
}

void dice::rollLeft() {
  roll(FRONT, RIGHT, BACK, LEFT);
}

std::vector<dice> dice::all_rolls() {
  std::vector<dice> ret;
  for(int k = 0; k < 6; (k&1 ? rollEast(): rollNorth()), ++k) {
    for(int i = 0; i < 4; rollRight(), ++i) {
      ret.push_back(*this);
    }
  }
  return ret;
}

void dice::roll(face a, face b, face c, face d) {
  int tmp = id[a];
  id[a] = id[b];
  id[b] = id[c];
  id[c] = id[d];
  id[d] = tmp;
}

int main() {
  int d;
  dice di;
  for(int i = 0; i < 6; ++i) {
    std::cin >> d;
    di.setDice(d, i);
  }
  std::vector<dice> v = di.all_rolls();

  int n;
  int x, y;
  for(std::cin>>n;  n > 0; --n) {
    std::cin >> x >> y;
    for(int i = 0; i < v.size(); ++i) {
      if(v[i][TOP] == x && v[i][FRONT] == y) {
        std::cout << v[i][RIGHT] << std::endl;
      }
    }
  }

  return 0;
}

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

int main()
{
    int N, M;
    cin >> N >> M;
    int Ai;
    int sum = 0;
    map<int, int> counts;
    counts[0] = 1;
    for(int i=0;i<N;i++){
        cin >> Ai; 
        sum = (sum + Ai) % M;
        if(counts.count(sum)==0) counts[sum] = 0;
        counts[sum]++;
    }
    long long res = 0;
    for(auto m : counts){
        res += (long long)m.second * (m.second - 1) / 2;
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3200
// "include" {{{
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <tuple>
// }}}
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int> 
#define int long long
#define setout(n,x) setw(n) << setfill(x)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1000000007;

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int d;
	cin >> d;
	if(d == 25) cout << "Christmas\n";
	else if(d == 24) cout << "Christmas Eve\n";
	else if(d == 23) cout << "Christmas Eve Eve\n";
	else cout << "Christmas Eve Eve Eve\n";
	return 0;
}


Measured memory_bytes: 256
import sys

h,w,m=map(int,input().split())


hlis=[0 for i in range(h)]
wlis=[0 for i in range(w)]
hw=[]

for i in range(m):
  hi,wi=map(int,input().split())
  hlis[hi-1]+=1
  wlis[wi-1]+=1
  hw.append([hi-1,wi-1])

hmax=max(hlis)
wmax=max(wlis)

ph=[]
pw=[]
for i in range(h):
  if hlis[i]==hmax:
    ph.append(i)
for i in range(w):
  if wlis[i]==wmax:
    pw.append(i)

if len(ph)*len(pw)>3*(10**5):
  print(hmax+wmax)
  sys.exit()

plis=[]
for phi in ph:
  for pwj in pw:
    plis.append(phi*(10**6)+pwj)

plis.sort()

hwlis=[]
for hi,wi in hw:
  hwlis.append(hi*(10**6)+wi)

hwlis.sort()
    
c=0
check=0

for pi in plis:
  while pi!=hwlis[c]:
    c+=1
    if c>=len(hwlis):
      check=1
      break
  if check==1:
    break

if check==1:
  print(hmax+wmax)
else:
  print(hmax+wmax-1)


Measured memory_bytes: 95540
#define dbg(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#define dpri(x) dbg(#x ": %d\n", x)
#define dprs(x) dbg(#x ": %s\n", x)
#include <stdio.h>
#include <stdlib.h>
typedef long long ll;
const int MYINF = 1e9+7;

#define MAX_N (200010)
int n;
int A[MAX_N];
int S[MAX_N];

ll count;
void merge(int l, int r) {
	if (l >= r) return;
	merge(l, (l+r)/2);
	merge((l+r)/2+1, r);
	int i, j, k;
	for (k = 0, i = l, j = (l+r)/2+1; k < r - l + 1; k++) {
		if (i > (l+r)/2) {
			S[k] = A[j++];
		} else if (j > r) {
			S[k] = A[i++];
		} else {
			if (A[i] > A[j]) {
				S[k] = A[j++];
				count += (l+r)/2 - i + 1;
			} else {
				S[k] = A[i++];
			}
		}
	}
	for (i = 0; i < r - l + 1; i++) {
		A[l+i] = S[i];
	}
}

ll ninversions(void) {
	merge(0, n-1);
	return count;
}

int main(int argc, char **argv)
{
	int i;
	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%d", &A[i]);
		//S[i] = A[i];
	}
	printf("%lld\n", ninversions());


	return 0;
}

Measured memory_bytes: 2156
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;

int main(){
    ll n,k; cin >> n >> k;
    ll ans = 1;
    ll cnt = 0;
    while(ans <= n){
        ans *= k;
        cnt++;
    }
    cout << cnt << endl;
}

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

int main(){
    int n;
    cin>>n;
    map<int,int> m;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        m[a]++;
        m[a-1]++;
        m[a+1]++;
    }
    int ans=0;
    for(auto p : m) ans=max(ans,p.second);
    cout<<ans<<endl;
}

Measured memory_bytes: 7956
#include <stdio.h>

int main(void){
 
  int n;
  int i,j;
  scanf("%d",&n);
  
  char m[n][5];
  double a[n];
  double tot = 0.0;
  
  for(i = 0; i < n; i++){
    scanf("%lf",&a[i]);
    scanf("%s",m[i]);
  }
  
  for(j = 0; j < n; j++){
       
    if(m[j][0] == 'B')
      tot += a[j] * 380000.0;
    else 
      tot += a[j]; 
  }
  
  printf("%f",tot);
  
  return 0;
  
}


Measured memory_bytes: 128
//https://atcoder.jp/contests/agc002/tasks/agc002_b
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
    ll N,M; cin>>N>>M;
    vector<ll> box(N+1,1);
    vector<bool> pr(N+1,false);
    pr[1]=true;
    REP(i,M){
        ll x,y; cin>>x>>y;
        if(pr[x]) pr[y]=true;
        --box[x];
        ++box[y];
        if(box[x]<=0) pr[x]=false;
    }
    ll ans=0;
    for(const auto& p:pr){
        if(p)++ans;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):  #要素xが属するグループの根を返す
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):  #要素xが属するグループと要素yが属するグループを併合
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):  #グループのサイズ
        return -self.parents[self.find(x)]

    def same(self, x, y):   #要素xと要素yが同じグループかどうか
        return self.find(x) == self.find(y)

    def members(self, x):   #要素xが属するグループに属する要素をリストで返す
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):    #すべての根の要素をリストで返す
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):  #グループの数を変えす
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n, m, k = map(int, input().split())
friend = UnionFind(n + 1)

a, b = [], []
num = [0] * (n + 1)
for i in range(m):
    aa, bb = map(int, input().split())
    a.append(aa)
    b.append(bb)
    num[aa] += 1
    num[bb] += 1
    friend.union(aa, bb)

c,d = [],[]
for i in range(k):
    cc, dd = map(int, input().split())
    c.append(cc)
    d.append(dd)

ans = [0] * (n + 1)
for i in range(1, n + 1):
    ans[i] = friend.size(i)
    ans[i] -= num[i]
    ans[i] -= 1

for i in range(k):
    if friend.same(c[i], d[i]):
        ans[c[i]] -= 1
        ans[d[i]] -= 1

for i in range(1, n + 1):
    print(ans[i],end=" ")

Measured memory_bytes: 25284
<?php
  
  list($s, $t) = explode(" ", trim(fgets(STDIN)));

  list($a, $b) = explode(" ", trim(fgets(STDIN)));

  $u = trim(fgets(STDIN));

  if($s == $u){
    $a--;
  }else{
    $b--;
  }

  echo $a." ".$b;

Measured memory_bytes: 4604
N, C = map(int, input().split())

D = [list(map(int, input().split())) for _ in range(C)]

c = [list(map(int, input().split())) for _ in range(N)]

group = [[0] * C for _ in range(3)]
for i in range(N):
    for j in range(N):
        group[(i + j) % 3][c[i][j] - 1] += 1

def calc(g, color): #g: groupをcolorに変える違和感を返す
    cost = 0
    for i in range(C):
        cost += group[g][i] * D[i][color]
    return cost

# for i in group:
#     print (i)

ans0 = []
for i in range(C):
    ans0.append((calc(0, i), i))
ans0.sort()

ans1 = []
for i in range(C):
    ans1.append((calc(1, i), i))
ans1.sort()

ans2 = []
for i in range(C):
    ans2.append((calc(2, i), i))
ans2.sort()

# print (ans0)
# print (ans1)
# print (ans2)

ans = 10 ** 18
for i in range(3):
    for j in range(3):
        for k in range(3):
            if ans0[i][1] != ans1[j][1] and ans1[j][1] != ans2[k][1] and ans2[k][1] != ans0[i][1]:
                ans = min(ans, ans0[i][0] + ans1[j][0] + ans2[k][0])

print (ans)

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

#整数値入力 1文字の入力
def input_one_number():
    return int(input())

#整数値龍力　複数の入力
def input_multiple_number():
    return map(int, input().split())

#整数値龍力　複数の入力(配列)
def input_multiple_number_as_list():
    return list(map(int, input().split()))

#2次元配列入力
def input_map():
    return [list(map(int,list(input()))) for i in range(h)]

#リスト出力
def print_list(list):
    print(*list)
    return

#2次元配列出力
def print_map(maplist):
    for i in maplist:print(*i, sep='')
    return

#素数生成
def generate_primenums():
    n = 100
    primes = set(range(2, n+1))
    for i in range(2, int(n**0.5+1)):
        primes.difference_update(range(i*2, n+1, i))
    primes=list(primes)
    return primes

def memo():
    a=[0]*5
    b=a  #良くない配列のコピー
    b2=a[:]  #1次元のときはコピーはこれで良い
    a[1]=3
    print('b:{}, b2:{}'.format(b,b2))  #b:[0, 3, 0, 0, 0], b2:[0, 0, 0, 0, 0]
    
    import copy
    a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
    b=copy.deepcopy(a)  #2次元配列はこうコピーする
    
    #内包表記奇数のみ
    odd=[i for i in range(100) if i%2==1] #[1, 3, 5, 7, 9, 11, 13, 15, 17, 19]

    #二部探索
    import bisect
    a = [1, 2, 3, 5, 6, 7, 8, 9]
    b=bisect.bisect_left(a, 8)

    #combinations、組み合わせ、順列
    from itertools import permutations, combinations,combinations_with_replacement,product
    a=['a','b','C']
    print(list(permutations(a)))
    print(list(combinations(a,2)))
    print(list(combinations_with_replacement(a,3)))


#階乗
def kaijo(n):
    import math
    return math.factorial(n)

#選び方（コンビネーション nCr）
def num_combination(n,r):
    import math
    return math.factorial(n) // math.factorial(n - r)


#最大公約数、最小公倍数
def calc_gcd(a,b):
    import fractions
    GCD=fractions.gcd(a,b)
    lcm=a*b//gcd
    return gcd,lcm

#複数の最大公約数
def calc_gcd_list(l):
    gcd = l[0]
    for i in range(1, N):
        gcd = fractions.gcd(gcd, l[i])
    return gcd

#各桁の和
def sum_digit(n):
    sum = 0
    while n > 0:
        sum += n%10
        n //= 10
    return sum

N,A,B = input_multiple_number()

ans=[]

for i in range(N+1):
    a = sum_digit(i)
    if A <= a and a <= B:
        ans.append(i)

sumans = 0
for j in ans:
    sumans += j

print(sumans)





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

int main(){
  ll n,m;
  cin>>n>>m;
  if (n-m>1||m-n>1){
    cout<<0<<endl;
    return 0;
	}
  else{
     ll ans=1;
     for (ll i=2;i<=n;i++){
        ans=(ans*i)%1000000007;
		}
     for (ll i=2;i<=m;i++){
		ans=(ans*i)%1000000007;
		}

	 if(n==m){
         ans=(ans*2)%1000000007;
		}
      cout<<ans<<endl;
	}
}


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

#define ll long long
#define nl '\n'
#define forn(i, n) for(ll i = 0; i < n; ++i)
#define fori(i, a, b) for(ll i = a; i < b; ++i)

using namespace std;

int main(){

    #ifdef LOCAL  
        freopen("input.txt", "r", stdin);
    #endif
    
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    ll a, b, c; cin >> a >> b >> c;

    ll an[11] = {0};
    an[a]++; an[b]++; an[c]++;

    if(an[5] == 2 && an[7] == 1) cout << "YES" << nl;
    else cout << "NO" << nl;
    return 0;
}	
    

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
int dp[5500][5500];//dp[i][j]iとjから初まる文字列の一致する長さのmax
int main()
{
    int n;
    string s;
    cin >> n;
    cin >> s;
    for(int i = n-1;i >= 0;--i){
        for(int j = n-1;j >= 0;--j){
            if(s[i] == s[j])dp[i][j] = dp[i+1][j+1] +1;

        }
    }
    int ans = 0;
    rep(i,n-1)for(int j = i+1;j <n;j++){
        int now = min(dp[i][j],j-i);
        ans = max(ans,now);
    }
    cout << ans << endl;

    
    return 0;
}

Measured memory_bytes: 108800
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
string a,b,c;

int main(){
	cin >> a >> b >> c;
	
	cout << a[0] << b[0] << c[0] << endl;
	return 0;
}


Measured memory_bytes: 256
def main():
    A, B, C = map(int, input().split())
    K = int(input())

    for i in range(3**K):
        ii = i
        AA, BB, CC = A, B, C
        for j in range(K):
            if ii % 3 == 0:
                AA *= 2
            elif ii % 3 == 1:
                BB *= 2
            else:
                CC *= 2
            ii = ii // 3
        if AA < BB < CC:
            print("Yes")
            return
    print("No")
    return

main()

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

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

    double A;
    double sum = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> A;
        sum += 1 / A;
    }
    cout << fixed << setprecision(12) << 1 / sum << endl;
}


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

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

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

    if(a<b){
        cout<<"a < b"<<endl;
    }else if(a>b){
        cout<<"a > b"<<endl;
    }else{
        cout<<"a == b"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3216
from itertools import product

def main():
    n = int(input())

    # Exception Handling
    if n == 1:
        print(1)
        exit()

    # calculate the maximum answer
    if n % 2 == 0:
        ans = 2 * n - 1
        n *= 2
    else:
        ans = n - 1

    # Prime Factorization
    factors = []
    for p in range(2, n):
        if p * p > n:
            if n > 1:
                factors.append(n)
            break

        if n % p == 0:
            cnt = 0
            while n % p == 0:
                cnt += 1
                n //= p
            factors.append(p ** cnt)

    # Full Search
    # k%factor==0 or (k+1)%factor==0
    for tf in product([True, False], repeat=len(factors)):
        a, b = 1, 1
        for i in range(len(factors)):
            if tf[i]:
                a *= factors[i]
            else:
                b *= factors[i]

        if a < b or a == 1 or b == 1:
            continue

        # Euclidean Algorithm
        # a*x - b*y = 1
        l = []
        quo = []
        while a % b > 1:
            l.append(a)
            a = b
            quo.append(0)
            quo[-1], b = divmod(l[-1], b)
        x, y = 1, a//b
        flag = True
        while l:
            if flag:
                x += y * quo.pop()
                b = l.pop()
            else:
                y += x * quo.pop()
                a = l.pop()
            flag = not flag

        if ans > b * y:
            ans = b * y

    print(ans)

main()

Measured memory_bytes: 68748
n = int(input())
s = input()
cnt = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            a = s.find(str(k))
            if a != -1 :
                b = s.find(str(j), a + 1)
                if b != -1 :
                    c = s.find(str(i), b + 1)
                    if c != -1 :
                        cnt += 1
                    
print(cnt)

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

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

using namespace std;

int main()
{
	int n;
	while(cin >> n && n)
	{
		vector<long long> a;
		rep(i,n)
		{
			int t;
			cin >> t;
			a.push_back(t);
		}
		sort(a.begin(),a.end());

		long long sum = 0;
		vector<long long> time;
		long long count = 0;
		rep(j,n-1)
		{
			count += a[j];
			time.push_back(count);
		}
		rep(j,time.size())
		{
			sum += time[j];
		}

		cout << sum << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1416
#include <bits/stdc++.h>
using namespace std;
#define sort(vec) sort(vec.begin(),vec.end())
#define reverse(vec) reverse(vec.begin(),vec.end())
#define unsort(vec); sort(vec);reverse(vec);
#define int long long
long long ans;

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

int lcm(int x,int y){
	return x*y/gcd(x,y);
}
 
signed main(){
	int a,b,k;
	cin>>a>>b>>k;
	for(int i=min(a,b);i>=1;i--){
		if(a%i==0&&b%i==0)k--;
		if(k==0){
			cout<<i<<endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
K, S = gets.chomp.split(" ").map(&:to_i)

ans = 0
(0..K).each{|i|
  next if S - i > 2 * K
  if S - i <= K then
    ans += (S - i + 1) if S - i + 1 > 0
  else
    ans += (2 * K - S + i + 1)
  end
}

puts ans


Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {
  
  public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    
    int H = Integer.parseInt(sc.next());
    int W = Integer.parseInt(sc.next());
    
    boolean s[][] = new boolean[H][W];
    int min[][] = new int[H][W];
    int black = 0;
    for (int i = 0; i < H; i++) {
      String str = sc.next();
      for (int j = 0; j < W; j++) {
        char input = str.charAt(j);
        if (input == '#') {
          black++;
          s[i][j] = false;
          min[i][j] = -1;
        } else {
          s[i][j] = true;
          min[i][j] = H * W;
        }
      }
    }
    min[0][0] = 1;
    boolean flag = true;
    while (flag) {
      flag = false;
      for (int i = 0; i < H; i++) {
        for (int j = 0; j < W - 1; j++) {
          if (s[i][j] && s[i][j + 1] && min[i][j] + 1 < min[i][j + 1]) {
            min[i][j + 1] = min[i][j] + 1;
            flag = true;
          }
        }
      }
      for (int j = 0; j < W; j++) {
        for (int i = 0; i < H - 1; i++) {
          if (s[i][j] && s[i + 1][j] && min[i][j] + 1 < min[i + 1][j]) {
            min[i + 1][j] = min[i][j] + 1;
            flag = true;
          }
        }
      }
      for (int i = 0; i < H; i++) {
        for (int j = W - 1; j > 0; j--) {
          if (s[i][j] && s[i][j - 1] && min[i][j] + 1 < min[i][j - 1]) {
            min[i][j - 1] = min[i][j] + 1;
            flag = true;
          }
        }
      }
      for (int j = 0; j < W; j++) {
        for (int i = H - 1; i > 0; i--) {
          if (s[i][j] && s[i - 1][j] && min[i][j] + 1 < min[i - 1][j]) {
            min[i - 1][j] = min[i][j] + 1;
            flag = true;
          }
        }
      }
    }
    
    if (min[H - 1][W - 1] == H * W) {
      System.out.println(-1);
    } else {
      System.out.println(H * W - black - min[H - 1][W - 1]);
    }
  }
}

Measured memory_bytes: 22868
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

struct Solver {
	void solve() {
		long X;
		cin >> X;

		long a = 100;
		int ans = 0;
		while( a < X ) {
			a += a / 100;
			ans += 1;
		}

		cout << ans << endl;
	}
};

int main() {
	ios::sync_with_stdio( false );
	cout << fixed << setprecision( 10 );
	Solver().solve();

	return 0;
}


Measured memory_bytes: 3572
#include <cstdio>
#include <cstring>
#include <algorithm>

const int N = 20, MOD = 1000000007;

int n, m, f[1 << N];

int mask[N][N];

bool init() {
  int k;
  scanf("%d%d%d", &n, &m, &k);
  --n;
  while (k--) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    mask[a - 1][b - 1] |= 1 << c;
  }
  for (int i = 0; i < m; ++i) if (std::count(mask[i], mask[i] + n, 3)) return false;
  return true;
}

void solve(int k) {
  int x = 0, y = 0;
  for (int i = 0; i < n; ++i) {
    if (mask[k][i] & 1) x |= 1 << i;
    if (mask[k][i] & 2) y |= 1 << i;
  }
  static int temp[1 << N];
  for (int i = 0; i < n; ++i) {
    memcpy(temp, f, sizeof temp);
    for (int s = 0; s < (1 << n); ++s) {
      if (!(s >> i & 1) || !f[s]) continue;
      int t = s ^ (1 << i);
      for (int j = i - 1; j >= 0; --j) if (t >> j & 1) break; else (temp[t | (1 << j)] += f[s]) %= MOD;
    }
    memcpy(f, temp, sizeof temp);
  }
  for (int i = 0; i < n; ++i) {
    memcpy(temp, f, sizeof temp);
    for (int s = 0; s < (1 << i); ++s) (temp[s | (1 << i)] += f[s]) %= MOD;
    memcpy(f, temp, sizeof temp);
  }
  for (int s = 0; s < (1 << n); ++s) if ((s & x) || (s & y) != y) f[s] = 0;
}

int main() {
  if (!init()) return puts("0"), 0;
  f[0] = 1;
  for (int i = 0; i < m; ++i) solve(i);
  int ans = 0;
  for (int s = 0; s < (1 << n); ++s) (ans += f[s]) %= MOD;
  printf("%d\n", (ans + MOD) % MOD);
  return 0;
}


Measured memory_bytes: 8448
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Apart{
    private int[][][] apart;
    public Apart(){
	apart=new int[4][][];
	for(int i=0;i<4;i++){
	    apart[i]=new int[4][];
	    for(int j=0;j<3;j++){
		apart[i][j]=new int[10];
		for(int k=0;k<10;k++){
		    apart[i][j][k]=0;
		}
	    }
	}
    }
    
    public void insert(int b,int f,int r,int v){
	apart[b-1][f-1][r-1]+=v;
    }

    public void print(){
	for(int i=0;i<4;i++){
	    for(int j=0;j<3;j++){
		for(int k=0;k<10;k++){
		    System.out.print(" "+apart[i][j][k]);
		}
		System.out.println("");
	    }
	    if(i!=4-1) System.out.println("####################");
	}
    }
}

class Main{
    public static void main(String[] args) throws IOException{
	final BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	final Apart ap=new Apart();
	String str=br.readLine();
	int n=Integer.parseInt(str);
	for(int i=0;i<n;i++){
	    String[] str2=br.readLine().split(" ");
	    int b=Integer.parseInt(str2[0]);
	    int f=Integer.parseInt(str2[1]);
	    int r=Integer.parseInt(str2[2]);
	    int v=Integer.parseInt(str2[3]);
	    ap.insert(b,f,r,v);
	}
	ap.print();
    }
}

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

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

static const int maxN = 333;
static const int base = 1e9 + 7;

int n, m;
int dp[maxN][maxN][maxN];
vector < pair <int, int> > L[maxN];

void Enter() {
    scanf("%d%d", &n, &m);
    FOR(i, 1, m) {
        int l, r, x; scanf("%d%d%d", &l, &r, &x);
        L[r].push_back(make_pair(l, x));
    }
}

bool ok (int i, int j, int k) {
    int r = max(i, max(j, k));
    for (auto v : L[r])
        if ((i >= v.first) + (j >= v.first) + (k >= v.first) != v.second) return 0;
    return 1;
}

void Process() {
    for (auto v : L[1]) if (v.second != 1) {
        puts("0");
        return;
    }
    dp[1][0][0] = dp[0][1][0] = dp[0][0][1] = 1;
    FOR(k, 1, n) {
        //k is res; i is blue; j is green
        REP(i, k) REP(j, k) if (i != j || !j) {
            if (ok(k + 1, i, j)) dp[k + 1][i][j] = (dp[k + 1][i][j] + dp[k][i][j]) % base;
            if (ok(k, k + 1, j)) dp[k][k + 1][j] = (dp[k][k + 1][j] + dp[k][i][j]) % base;
            if (ok(k, i, k + 1)) dp[k][i][k + 1] = (dp[k][i][k + 1] + dp[k][i][j]) % base;
        }
        //i is red; k is blue; j is green
        REP(i, k) REP(j, k) if (i != j || !j) {
            if (ok(i, k + 1, j)) dp[i][k + 1][j] = (dp[i][k + 1][j] + dp[i][k][j]) % base;
            if (ok(k + 1, k, j)) dp[k + 1][k][j] = (dp[k + 1][k][j] + dp[i][k][j]) % base;
            if (ok(i, k, k + 1)) dp[i][k][k + 1] = (dp[i][k][k + 1] + dp[i][k][j]) % base;
        }
        //i is red; j is blue; k is green
        REP(i, k) REP(j, k) if (i != j || !j) {
            if (ok(i, j, k + 1)) dp[i][j][k + 1] = (dp[i][j][k + 1] + dp[i][j][k]) % base;
            if (ok(i, k + 1, k)) dp[i][k + 1][k] = (dp[i][k + 1][k] + dp[i][j][k]) % base;
            if (ok(k + 1, j, k)) dp[k + 1][j][k] = (dp[k + 1][j][k] + dp[i][j][k]) % base;
        }
    }
    int res = 0;
    REP(i, n + 1) REP(j, n + 1) REP(k, n + 1)
        if (i == n || j == n || k == n)
            res = (res + dp[i][j][k]) % base;
    printf("%d\n", res);
}

int main() {
  //  freopen("input.in", "r", stdin);
//    freopen("output.out", "w", stdout);

    Enter();
    Process();

    return 0;
}


Measured memory_bytes: 131328
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
int main(){
 
	ll n;
	cin >> n;

	ll ans = 0;
	ll mod = 1e9 + 7;

	vector<vector<ll>> dp(2005, vector<ll>(2005));

	for(int i = 1; i < 2005; i++){
		dp[1][i] = 1;
	}

	for(int i = 1; i < 2005; i++){
		dp[i][0] = 1;
		dp[i][1] = i;
	}

	for(int i = 2; i < 2005; i++){
		for(int j = 2; j < 2005; j++){
			dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
		} 
	}


	ll curr = n/3;
	ll ind = n%3;

	while(curr > 0){
		ans = (ans + dp[curr][ind])%mod;
		curr--;
		ind += 3;				
	}

	cout << ans%mod << "\n";
}

Measured memory_bytes: 34668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const ll MOD=1e9+7;
const ll INF=1ll<<60;

//
//　定数, 変数 *********************************************
string S,T;

// *********************************************************
int main(){

    // 入力スタンダード
    cin >> S >> T ;
    
    if(T.compare(0, S.size(), S, 0,S.size())==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }




    return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define ll long long
#define INF 0x3f3f3f3f
#define eps 1e-8
#define pb push_back
#define endl '\n'
using namespace std;
const ll maxn = 2e6 + 5;
ll num[maxn],a,b,c,d,t,n,m,k,ans;
string str;
int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++){
        if(i % 3 && i % 5)
            ans += i;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3616
[input_n, input_m] = map(int, input().split())

input_ks = [list(map(int, input().split())) for i in range(input_m)]
input_p = list(map(int, input().split()))

switch_list = [[bool(i & 2 ** j) for j in range(input_n)]
               for i in range(2 ** input_n)]

count = 0
for switch in switch_list:
    switchPattern = []
    for m in range(input_m):
        switchPattern.append(sum(switch[l - 1] for l in input_ks[m][1:]) %2 == input_p[m])
    if (all(switchPattern)):
        count += 1
print(count)

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

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a.at(i);
	}

	map<int, int> cnt;		// i+Aiを記録するmap

	// mapを作成しながら、indexが自身より小さいモノに関してi-Aiと一致する個数を数える。
	int64_t ans = 0;
	for (int i = 0; i < n; i++) {
		// 条件を満たすペアを数える。
		if (cnt.count(i - a.at(i))) {
			ans += cnt.at(i - a.at(i));
		}
		// mapの更新
		if (cnt.count(i + a.at(i))) {
			cnt.at(i + a.at(i))++;
		} else {
			cnt[i + a.at(i)] = 1;
		}
	}

	cout << ans << endl;
}


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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

template<int M>
class Combination
{
public:
  int n;
  vector<int> fac, finv;

  Combination(int n_) : n(n_), fac(n_), finv(n_)
  {
    fac[0] = 1;
    for(int i = 1; i < n; i++) fac[i] = fac[i-1]*i%M;
    finv[n-1] = pow(fac[n-1], M-2);
    for(int i = n-1; i > 0; i--) finv[i-1] = finv[i]*i%M;
  }

  int pow(int a, int b)
  {
    if(b == 0) return 1; 
    return pow(a*a%M, b/2)*(b%2?a:1)%M;
  }

  int C(int a, int b)
  {
    if(b < 0 or a < b) return 0;
    return fac[a]*finv[a-b]%M*finv[b]%M;
  }

  int P(int a, int b)
  {
    if(b < 0 or a < b) return 0;
    return fac[a]*finv[a-b]%M; 
  }

  int H(int a, int b){
    if(a == 0 and b == 0) return 1;
    return C(a+b-1, b);
  }
};

signed main(){
	Combination<mod> comb(200010);
	int n, m, k;
	cin >> n >> m >> k;

	int ans = 0;
	rep(i, 0, n){
		int d = i*(i+1)/2%mod;
		d = d*m%mod*m%mod;
		ans += d;
	}
	rep(i, 0, m){
		int d = i*(i+1)/2%mod;
		d = d*n%mod*n%mod;
		ans += d;
	}

	cout << ans%mod*comb.C(n*m-2, k-2)%mod << endl;

	return 0;
}


Measured memory_bytes: 3328
function Main(input) {
	const inputs = input.split("");
	
	const trueSquare = inputs.filter(square => parseInt(square) === 1);
	console.log(trueSquare.length);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
int main() {
     int X; cin >> X;
     int ans = 1;
     for(int b = 2; b <= X; b++){
          int x = b*b;
          for(int p = 2; ; p++){
               if(x > X) break;
               ans = max(ans,x);
               x *= b;
          }
     }
     cout << ans << endl;
}

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

typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B, C;
    cin >> A >> B >> C;
    int ans = 0;
    int evennum = 0;
    if(A % 2 == 0)evennum++;
    if(B % 2 == 0)evennum++;
    if(C % 2 == 0)evennum++;

    if(evennum == 1){
        ans += 2;
        if(A % 2 == 1)A++;
        if(B % 2 == 1)B++;
        if(C % 2 == 1)C++;
    }
    if(evennum == 2){
        ans += 2;
        if(A % 2 == 0)A++;
        if(B % 2 == 0)B++;
        if(C % 2 == 0)C++;
    }
    cout << (ans + max(A,max(B,C))*3 - A - B - C)/2 << endl;
}


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

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

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
	
		MyScanner sc = new MyScanner();
		long a=sc.nextLong();
		long b=sc.nextLong();
		if(a%b==0) {
			a=-1;
		}
		else {
			while(a%b==0) {
			a++;
			}
		}	
		System.out.println(a);
	}
	
	public static PrintWriter out;

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

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

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

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

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

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

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

	}
	

}





Measured memory_bytes: 22740
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextIntSlice(size int) []int {
	re := make([]int, size)
	for i := 0; i < size; i++ {
		re[i] = nextInt()
	}
	return re
}

func max(a []int) int {
	max := a[0]
	for _, v := range a {
		if v > max {
			max = v
		}
	}
	return max
}

func min(a []int) int {
	min := a[0]
	for _, v := range a {
		if v < min {
			min = v
		}
	}
	return min
}

func main() {
	sc.Split(bufio.ScanWords)
	a, b, c := nextInt(), nextInt(), nextInt()

	for i := 1; i <= b; i++ {
		if a*i%b == c {
			fmt.Println("YES")
			return
		}
	}
	fmt.Println("NO")
}


Measured memory_bytes: 640
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

double degrees(double rad) {
    return 180 * rad / PI;
}

double calc(double a, double b, double x) {
    // 水が半分以上かどうかで場合分け
    double theta;
    if (x >= a * a * b / 2) {
        theta = atan(2 * (a * a * b - x) / (a * a * a));
    }
    else {
        theta = atan((a * b * b) / (2 * x));
    }
    return degrees(theta);
}

void main() {
    int a, b, x; scan(a, b, x);
    writefln("%.8f", calc(a, b, x));
}


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

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b == 0) return a;
	return gcd(a % b, b);
}

int n;
int pre[500000], suf[500000], a[500000];

int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i <= n; i++) pre[i] = gcd(pre[i -1], a[i]);
	for (int i = n; i >= 1; i--) suf[i] = gcd(suf[i +1], a[i]);
	int ans = 1;
	for (int i = 1; i <= n; i++)
	    ans = max(ans, gcd(pre[i - 1], suf[i + 1]));
	 cout << ans;
}

Measured memory_bytes: 2944