akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int A,B,ans=0;
  cin>>A>>B;
  if(abs(A-B)<=1){
    ans=1;
    if(A==B)
      ans=2;
    REP(i,2,A){
      ans*=i;
      ans%=MOD;
    }
    REP(i,2,B){
      ans*=i;
      ans%=MOD;
    }
  }
  cout<<ans<<endl;
  }


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
using namespace std;
#define REP(i,n) for (int i=0; i<n; i++)
#define ADD(a,b,c) "("+ a +" "+ c +" "+ b +")"

string i2s(int n){
  stringstream ss;
  ss << n;
  return ss.str();
}

int op(int x, int y, int mode){
	switch (mode){
	case 0:
		return x+y;
	case 1:
		return x-y;
	case 2:
		return x*y;
	}
}

string check(int x[], int n){
	int x0=x[0], x1=x[1], x2=x[2], x3=x[3];
	string s0=i2s(x0), s1=i2s(x1), s2=i2s(x2), s3=i2s(x3);
	string ops="+-*", eq1, eq2;
	int n1 = ops.size();
	REP(i1, n1){
		int a1 = op(x0, x1, i1);
		eq1 = ADD(s0, s1, ops[i1]);
		REP(i2, n1){
			int a2 = op(a1, x2, i2);
			eq2 = ADD(eq1, s2, ops[i2]);
			REP(i3, n1)
				if (op(a2, x3, i3)==n) return ADD(eq2, s3, ops[i3]);
			a2 = op(x2, x3, i2);
			eq2 = ADD(s2, s3, ops[i2]);
			REP(i3,n1)
				if (op(a1, a2, i3)==n) return ADD(eq1,eq2,ops[i3]);
		}
	}
	return "";
}

int f0041(){
	int n=10, x[4];
	while (cin>>x[0]>>x[1]>>x[2]>>x[3]){
		if (x[0]==0 && x[1]==0 && x[2]==0 && x[3]==0) return 0;

		sort(x,x+4);
		bool f = true;
		do{
			string s = check(x, n);
			if (s != ""){
				cout<<s<<endl;
				f = false;
				break;
			}
		}while (next_permutation(x,x+4));
		if (f) cout<<"0"<<endl;
	}
}

int main(void){
	f0041();
}

Measured memory_bytes: 1248
import bisect
def primecheck(n):
    for i in range(3,int(n**0.5)+1,2):
        if n%i==0:return False
    prime.append(n)
    return True
def primeadd(n):
    for i in range(prime[-1]+2,2*n+2,2):
        primecheck(i)
prime=[2,3]
while 1:
    n=int(input())
    if n==0:break
    primeadd(n)
    print(bisect.bisect_left(prime,2*n+1)-bisect.bisect_left(prime,n+1))


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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll 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(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  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, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


mint choose (int n, int a) {
    mint x = 1, y = 1;
    rep(i, a) {
        x *= n-i;
        y *= i+1;
    }
    return x/y;
}

int main() {
    int s;
    cin >> s;
    int stick = 0;
    stick = s / 3;
    mint ans = choose(1, 0) - choose(1, 0);
    rep(i, stick) {
        s -= 3;
        ans += choose(s+i, i);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3632
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve() {
		long N = nl(), A = nl(), B = nl();
		long ans = N / (A + B) * A + Math.min(N % (A + B), A);
     	out.println(ans);
	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

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

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}


Measured memory_bytes: 23124
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from functools import reduce, lru_cache
import collections, heapq, itertools, bisect
import math, fractions
import sys, copy

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline().rstrip())
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline().rstrip())
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007

def main():
    N = I()
    A = []
    for _ in range(N):
        ni = I()
        A.append(LIR(ni))

    ans = 0
    for bit in range(1 << N):
        pattern = [bit >> i & 1 for i in range(N)]
        for (i, Ai) in enumerate(A):
            if not pattern[i]:
                continue
            # iが正直者の時
            for (x, y) in Ai:
                target = pattern[x-1]
                if target != y:
                    break
            else:
                continue
            break
        else:
            ans = max(ans, pattern.count(1))

    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 79544
//Daniel Grzegorzewski
#include <bits/stdc++.h>

#define MP make_pair
#define PB push_back
#define ST first
#define ND second
#define int long long

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios()
{
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

const int lo = 18;
const int N = (int)1e5 + 10;

int n, x[N], l, q;
PII res[N][lo];

PII calcDist(int p, int q)
{
	if (p == q)
		return {1, 0};
	int dist = q-p;
	for (int i = lo; i >= 0; --i)
		if (dist&(1<<i)) {
			PII tmp = res[p][i];
			if (p+(1<<i) == q)
				return tmp;
			int id = p+(1<<i);
			if (tmp.ND+x[id+1]-x[id] > l)
				tmp.ND = 0;
			else {
				int x1 = id+1, x2 = q, x3;
				while (x2-x1 > 1) {
					x3 = (x1+x2)/2;
					if (tmp.ND+x[x3]-x[id] > l)
						x2 = x3;
					else
						x1 = x3;
				}
				if (x2 == q && tmp.ND+x[x2]-x[id] <= l)
					return {tmp.ST, tmp.ND+x[x2]-x[id]};
				else if (tmp.ND+x[x2]-x[id] <= l)
					id = x2;
				else
					id = x1;
				tmp.ND = 0;
			}
			PII pom = calcDist(id, q);
			return {tmp.ST+pom.ST, pom.ND};
		}
}

signed main()
{
    init_ios();
    cin >> n;
    for (int i = 1; i <= n; ++i)
    	cin >> x[i];
    cin >> l >> q;
    for (int i = 1; i < n; ++i)
    	res[i][0] = {1, x[i+1]-x[i]};
   	for (int loga = 1; loga < lo; ++loga)
   		for (int i = n-1; i >= 1; --i)
   			if (i+(1<<loga) <= n) {
   				bool flag = false;
   				PII tmp = res[i][loga-1];
   				int id = i+(1<<(loga-1));
   				if (tmp.ND+x[id+1]-x[id] > l)
   					tmp.ND = 0;
   				if (tmp.ND != 0) {
   					int x1 = id+1, x2 = i+(1<<loga), x3;
   					while (x2-x1 > 1) {
   						x3 = (x1+x2)/2;
   						if (tmp.ND+x[x3]-x[id] > l)
   							x2 = x3;
   						else
   							x1 = x3;
   					}
   					if (x2 == i+(1<<loga) && tmp.ND+x[x2]-x[id] <= l) {
   						flag = true;
   						res[i][loga] = {tmp.ST, tmp.ND+x[x2]-x[id]};
   					}
   					else if (tmp.ND+x[x2]-x[id] <= l)
   						id = x2;
   					else
   						id = x1;
   				}
   				if (!flag) {
   					tmp.ND = 0;
   					PII pom = calcDist(id, i+(1<<loga));
   					res[i][loga] = {tmp.ST+pom.ST, pom.ND};
   				}
   			}
   	while (q--) {
   		int x, y;
   		cin >> x >> y;
   		int mn = min(x, y);
   		int mx = max(x, y);
   		cout<<calcDist(mn, mx).ST<<"\n";
   	}
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  string S;
  cin >> N >> S;
  int w = 0, b = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '.') w++;
  }
  int res = w + b;
  for (int i = 0; i < N; i++) {
    if (S[i] == '.') w--;
    if (S[i] == '#') b++;
    res = min(res, w + b);
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; ++i)
#define RREP(i, n) for (int i = n; 0 <= i; --i)
#define FOR(i, start, end) for (int i = start; i < end; ++i)
#define RFOR(i, start, end) for (int i = start; end <= i; --i)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }

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

    string S; cin >> S;
    bool ans = true;
    REP (i, S.size()) {
        if ((i%2==0 && S[i] == 'L')||(i%2==1 && S[i] == 'R')) {
            ans = false;
            break;
        }
    }
    cout << ((ans)?"Yes":"No") << '\n';
    return 0;
}



Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

d, d_skip = [0], [0]
for i in range(n):
    if i == 0:
        d.append(abs(a[i]))
    else:
        d.append(abs(a[i]-a[i-1]))
d.append(abs(a[-1]))

for i in range(n):
    if i == 0:
        d_skip.append(abs(a[i+1]))
    elif i < n-1:
        d_skip.append(abs(a[i+1] - a[i-1]))
    else:
        d_skip.append(abs(a[i-1]))

d_cumsum = [0]
for d_i in d[1:]:
    d_cumsum.append(d_i+d_cumsum[-1])
# print(d_cumsum, d_skip)
for i in range(1, n+1):
    ans = d_cumsum[i-1] + d_skip[i] + (d_cumsum[-1] - d_cumsum[i+1])
    print(ans)

Measured memory_bytes: 20816
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
int dx[]={0,1,-1,0};
int dy[]={-1,0,0,1};
int n,m,k,u,v,x,y;
const int inf=1e9;
bool ok(int i,int j)
{
	return (i>=0 and j>=0 and i<n and j<m);
}
int32_t main()
{
	
	cin>>n>>m>>k;
	char a[n][m];int dist[n][m];
	int x1,y1,x2,y2;
	cin>>x1>>y1>>x2>>y2;
	x1--;y1--;x2--;y2--;
	for(int i=0;i<n;i++)
	for(int j=0;j<m;j++)
	{cin>>a[i][j];dist[i][j]=inf;}
	dist[x1][y1]=0;
	queue<pair<int,int>> q;
	q.push({x1,y1});
	
	while(!q.empty())
	{
		tie(x,y)=q.front();
		q.pop();
		
		for(int kk=0;kk<4;kk++)
		{
			u=x;v=y;
			for(int tm=0;tm<k;tm++)
			{
				u+=dx[kk];v+=dy[kk];
				if(!ok(u,v))break;
				if(dist[u][v]<=dist[x][y])break;
				if(a[u][v]=='@')break;
				
				if(dist[u][v]>dist[x][y]+1)
				{
					dist[u][v]=dist[x][y]+1;
					q.push({u,v});
				}
			}
		}
	}
	
	if(dist[x2][y2]==inf)cout<<-1;
	else cout<<dist[x2][y2];
	
	
}

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

int main(){

  int n[5];

  for(int i=0;i<5;i++) cin>>n[i];

  sort(n, n+5);

  for(int i=0;i<5;i++){
      cout<<n[4-i];
      if(i==4) cout<<endl;
      else cout<<" ";
    }
	
  return 0;
}

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

int main(){
	int x,y,w,h,r;
	cin >> w >> h >> x >> y >> r;
	
	if((x<=w-r)&&(x>=r)&&(y<=h-r)&&(y>=r )) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}



Measured memory_bytes: 3096
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<limits.h>
#include<math.h>

#define MAX(a, b) (a>b?a:b)
#define MIN(a, b) (a<b?a:b)
#define MOD 1000000007

long long int abso(long long int n) {
    if(n < 0)
        return n*(-1);
    return n;
}

int compare(const void* a, const void* b) {
    return *(int*)a-*(int*)b;
}

void testCase() {
    int n, i, k, a, b;
    if(scanf("%d%d%d", &k, &a, &b)) {
        for(i=a;i<=b;i++) {
            if(i%k == 0) {
                printf("OK\n");
                return;
            }
        }
        printf("NG\n");
    }
}

int main() {
    int t=1;
    // scanf("%d", &t);
    while(t--) {
        testCase();
    }
    return 0;
}

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

int main() {
  string s;
  cin>>s;
  for(int i=0;i<5;i++)cout<<s[i];
  cout<<" ";
  for(int i=0;i<7;i++)cout<<s[i+6];
  cout<<" ";
  for(int i=0;i<5;i++)cout<<s[i+14];
  cout<<endl;
}


Measured memory_bytes: 256
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

dd = inputs[0][0]
nn = inputs[0][1]

# body
if $debugFlag
  p dd
  p nn
end

if nn == 100
  nn = 101
end

puts (10**(2*dd))*nn


Measured memory_bytes: 1788
a=int(input())
b=int(input())
c=int(input())
x=int(input())
count=0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if (500*i)+(100*j)+(50*k)==x:
        count+=1
print(count)

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

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

int MOD=1e9+7;
ll INF=1e18;

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

int main(){
    int n, m; cin>>n>>m;
    vector<vector<P>> g(n+10);
    for(int i=0; i<m; i++){
        int p, y; cin>>p>>y;
        p--;
        g[p].emplace_back(P(y, i));
    }

    for(int i=0; i<n; i++){
        sort(g[i].begin(), g[i].end());
    }

    int cnt=0;
    vector<string> ans(m);
    for(int i=0; i<n; i++){
        for(int j=0; j<g[i].size(); j++){
            int y, id;
            tie(y, id)=g[i][j];
            int hdigit=0, tdigit=0, head=i+1, tail=j+1;
            while(head>0){
                head/=10;
                hdigit++;
            }
            while(tail>0){
                tail/=10;
                tdigit++;
            }
            for(int k=1; k<=6-hdigit; k++) ans[id]+="0";
            ans[id]+=to_string(i+1);
            for(int k=1; k<=6-tdigit; k++) ans[id]+="0";
            ans[id]+=to_string(j+1);
        }
    }

    for(int i=0; i<m; i++){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 12416
/*I know about "bits/stdc++.h" 
But I am not using it for some technical issue*/

#include "iostream"
#include "algorithm"
#include "iomanip"
#include "vector"
#include "set"
#include "sstream"
#include "fstream"
#include "cstring"
#include "cmath"
#include "utility"
#include "map"
#include "bitset"
#include "cassert"
#include "deque"

#define sp <<" "
#define el <<"\n"
#define S second
#define F first
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define obit __builtin_popcount
#define pof pop_front
#define mod (int)1e9 + 7
#define For(i,a,n) for(i=a;i<n;i++)

using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned short int us;
typedef short int ss;
typedef long double ld;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int i,ans;
	For(i,1,6){
	 int r; cin>>r;
	 if(r==0) ans = i;
	}
	cout<<ans;
  return 0;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };




void solve() {
    int N; cin >> N;
    vector<ll> a(N);
    rep(i, N) cin >> a[i];
    ll res = 0;
    ll d = 1;
    rep(i, 65){
        int n0=0, n1=0;
        rep(j, N){
            if((1 & (a[j] >> i)) == 0) n0++;
            else n1++;
        }
        res = modint(modint(res) + modint(n0)*modint(n1)*modint(d));
        d *= 2;
    }

    cout << res << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 6784
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();

    for(int i=0 ; i<=300 ; i++){
      if(i%2==0){
        if(c-b<=0){
          System.out.println("Yes");
          break;
        }else{
          c = c-b;
        }
      }else{
        if(a-d<=0){
          System.out.println("No");
          break;
        }else{
          a = a-d;
        }
      }

    }
  }
}


Measured memory_bytes: 35840
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define ALL(v) v.begin(),v.end()
#define mp make_pair
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}}
template <class X> void prrr(X test){int f=0;for(auto it:test){cout<<(f++!=0?" ":"")<<it;}cout<<endl;}
template<typename X>
istream&operator>>(istream&i,vector<X>&v){for(X&x:v)i>>x;return i;}

class UF { // union find from https://github.com/kartikkukreja/blog-codes (MIT)
    // [usage]
    // auto uf = new UF(n);
    // uf->merge(l, r); // 0 <= l, r <= n-1
    // ...
public:
    int *id; // inner id
    int cnt; // number of all vartices
    int *sz; // sz[i] means size of i's set
    UF(int N)   {
        cnt = N;
        id = new int[N];
        sz = new int[N];
        for(int i=0; i<N; i++) {
            id[i] = i;
            sz[i] = 1;
        }
    }
    ~UF() {
        delete [] id;
        delete [] sz;
    }
    int find(int p) {
        int root = p;
        while (root != id[root]) root = id[root];
        while (p != root) {
            int newp = id[p];
            id[p] = root;
            p = newp;
        }
        return root;
    }
    void merge(int x, int y) {
        int i = find(x);
        int j = find(y);
        if (i == j) return;
        
        if (sz[i] < sz[j]) {
            id[i] = j;
            sz[j] += sz[i];
        } else {
            id[j] = i;
            sz[i] += sz[j];
        }
        cnt--;
    }
    bool connected(int x, int y) {
        return find(x) == find(y);
    }
    int count() {
        return cnt;
    }
};

// return sorted 約数list 1 <= x <= n
vector<ll> divv(ll n) {
  vector<ll> v;
  for(ll i = 1; i*i <= n; i++) {
    if(n%i == 0) {
      v.push_back(i);
      if(i*i != n) v.push_back(n/i);
    }
  }
  sort(ALL(v));
  return v;
}

int main() {
    ll n,k,q;
    cin>>n>>k>>q;
    vector<ll> a(q);
    cin>>a;
    unordered_map<ll,ll> aa;
    rep(i, q){
        aa[a[i]-1]+=1;
    }
    ll sum = 0;
    rep(ai, n){
        if(aa[ai] + k - q > 0 ) pr("Yes");
        else pr("No");
    }
    
}

Measured memory_bytes: 5540
#include<iostream>
#include<string>
#include<cmath>
using namespace std;
int main(){
	string s;
	int s1,s2=0;
	cin>>s1>>s;
	int n=s.size();
	for(int i=0;i<n;i++){
		s2=s2*10+(s[i]-'0');
		s1*=10;
	}
	//cout<<s1<<endl;
	//cout<<s2<<endl;
	s1+=s2;
	//cout<<s1<<endl;
	//if(sqrt(s1)*sqrt(s1)==s1)
	for(int j=1;j<1000;j++)
	{
		if(j*j==s1)
		{
		cout<<"Yes"<<endl;
		return 0;
	}
    }
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iomanip>
#include <random>
#include <time.h>
#include <vector>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <cstdlib>
#include <typeinfo>
#include <math.h>
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
	long long int k, t, a[110], ma = 0, ans = 0;
	cin >> k >> t;
	for (int i = 1; i <= t; i++) {
		cin >> a[i];
		ma = max(ma, a[i]);
	}
	ma = k - (2 * (k - ma) + 1);
	ans = max(ans, ma);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    map<char,int> mp;
    for(char c='a';c<='z';c++) mp[c]=INF;
    rep(i,n){
        string s;
        cin>>s;
        map<char,int> now;
        for(char c='a';c<='z';c++) now[c]=0;
        rep(j,s.size()) now[s[j]]++;
        for(auto itr:now) chmin(mp[itr.fi],itr.se);
    }
    string ans;
    for(auto itr:mp){
        rep(i,itr.se) ans+=itr.fi;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,h,i,j,k,l,m,n,x,y;
	ll		ans = 0;
	string	s;
	cin >> n;

	for(i=1;i<=n;i++) {

		ans += (n-(n%i)+i)*(n/i)/2;
	}

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


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    set<int> s;
    s.insert(a);
    s.insert(b);
    s.insert(c);
    cout << s.size() << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fori(i, S, E) for (int i = S; i < E; i++)
#define all(x) x.begin(), x.end()

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

    vector<vector<char>> C (H, vector<char>(W));

    fori(i, 0, H) {
    fori(j, 0, W) {
        cin >> C[i][j];
    }
        cin.ignore();
    }

    long long best = 9987654321;

    vector<int> amount (H, 0);
    vector<int> line_amount (H, 0);

    fori(b, 0, 1 << (H - 1)) {
        fill(all(amount), 0);

        vector<int> cuts (W, 0);

        bool impossible = false;

        fori(j, 0, W) {
            int p = 0;

            fori(i, 0, H) {
                line_amount[p] += C[i][j] - '0';

                if (amount[p]+line_amount[p] > K) {
                    fill(all(amount), 0);
                    if (cuts[j] == 0) {
                        cuts[j] = 1;
                    } else {
                        impossible = true;
                    }
                }

                if (b & (1 << i)) {
                    p++;
                }
            }

            fori(k, 0, H) {
                amount[k] += line_amount[k];
                line_amount[k] = 0;
            }
        }

        if (!impossible) {
            long long horizontal_cuts = accumulate(all(cuts), 0);
            long long vertical_cuts = __builtin_popcount(b);

            best = min(best, horizontal_cuts + vertical_cuts);
        }
    }

    cout << best << "\n";
}

Measured memory_bytes: 256
def main():
    from heapq import heappush, heappop

    N = int(input())
    *a, = map(int, input().split())

    add = [0] * (N + 1)
    sub = [0] * (N + 1)

    add_sum = 0
    h = []
    for x in a[:N]:
        heappush(h, x)
        add_sum += x

    add[0] = add_sum
    for i, x in enumerate(a[N:N * 2], 1):
        heappush(h, x)
        r = heappop(h)
        add_sum += x - r
        add[i] = add_sum

    a.reverse()
    *a, = map(lambda x: -x, a)
    sub_sum = 0
    h = []
    for x in a[:N]:
        heappush(h, x)
        sub_sum += x

    sub[0] = sub_sum
    for i, x in enumerate(a[N:N * 2], 1):
        heappush(h, x)
        r = heappop(h)
        sub_sum += x - r
        sub[i] = sub_sum

    ans = -10 ** 14
    for i in range(N + 1):
        ans = max(ans, add[i] + sub[N - i])
    print(ans)


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())


Measured memory_bytes: 39004
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int payment = sc.nextInt();
    if (payment % 1000 == 0) {
      System.out.println(0);
    } else {
      int charge = 1000 - (payment % 1000);
      System.out.println(charge);
    }
  }
}


Measured memory_bytes: 35704
s=input()
n=len(s)
k=(n-1)//2
l=(n+3)//2
if(s==s[::-1]):
	if(s[:k]==s[:k][::-1]):
		if(s[l-1:n]==s[l-1:n][::-1]):
			print("Yes")
		else:
			print("No")
	else:
		print("No")
else:
	print("No")


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

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i,N) cin >> a.at(i);
    vector<int> num(100010);
    rep(i,N){
        num.at(a.at(i))++;
    }
    //int X;
    int cnt = 0;
    //vector<int> vec(N);
    //rep(i,N) 
    for(int i = 1;i < 100000;i++){
        int newcnt = 0;
        newcnt = num.at(i-1) + num.at(i) + num.at(i+1);
        if(newcnt > cnt){
            cnt = newcnt;
            //cout <<i <<endl;
        }
    }
    cout << cnt <<endl;
    /*
    for(int i=1;i<100010;i++){
        int newcnt = 0;
        for(int j = 0;j < N;j++){
            if(a.at(j) <= i+1 && a.at(j) >= i-1){
                newcnt++;
            } 
        }
        if(cnt < newcnt) cnt = newcnt;
    }
    cout << cnt <<endl;
    */
}

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

int main () {
  int n, m, a, b, ans = 0;
  cin >> n >> m;
  vector<vector<int>> data(n,vector<int>(1));
  for (int i = 0; i < n; i++) {
    int h;
    cin >> h;
    data[i][0] = h;
  }
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    a --; b --;
    data[a].push_back(data[b][0]);
    data[b].push_back(data[a][0]);
  }
  bool x;
  for (int i = 0; i < n; i++) {
    if (data[i].size() == 1) {
      ans ++;
    }
    else {
      x = true;
      for (int j = 1; j < data[i].size(); j++) {
        if (data[i][0] <= data[i][j]) {
          x = false;
          break;
        }
      }
      if (x) {
        ans ++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 9332
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    vector<int> a;
    int sum = 0;
    for(int i=0,val;i<n;++i){
        cin>>val;
        a.push_back(val);
        sum += val;
    }
    int ans = 0;
    for(int i=0;i<n;++i){
        float f = sum/(float)(4*m);
        if(a[i]>=f){
            ++ans;
        }
    }
    cout<<(ans >= m ? "Yes" : "No")<<'\n';
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::cmp;

fn read<T: std::str::FromStr>() -> T {
    let stdin = stdin();
    let mut buf = String::new();
	stdin.lock().read_line(&mut buf);
	buf.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
	read::<String>().trim().split_whitespace()
        .map(|w| w.parse().ok().unwrap()).collect()
}

fn read_vec_char() -> Vec<char> {
    read::<String>().chars().collect()
}

fn read_mat<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn read_mat_char(n: usize) -> Vec<Vec<char>> {
    (0..n).map(|_| read_vec_char()).collect()
}

const D: usize = 998244353;

fn pow_mod(n: usize, mut m: usize) -> usize {
    let mut ret = 1;
    let mut k = n;
    while m > 0 {
        if m % 2 == 1 {
            ret = ret * k % D;
        }
        m /= 2;
        k = k * k % D;
    }
    ret
}

fn inv_mod(n: usize) -> usize {
    pow_mod(n,D-2)
}

fn main() {
    let v = read_vec::<usize>();
    let (n,a,b,k) = (v[0],v[1],v[2],v[3]);
    let mut ans = 0;
    let mut facts: Vec<usize> = vec![1;n+1];
    let mut factsi: Vec<usize> = vec![1;n+1];
    for i in 2..n+1 {
        facts[i] = facts[i-1] * i % D;
        factsi[i] = inv_mod(facts[i]);
    }
    for i in 0..cmp::min(k/a,n)+1 {
        let j = (k - a * i) / b;
        if (k - a * i) % b != 0 || j > n {
            continue;
        }
        ans = (ans
            + (facts[n] * factsi[i] % D * factsi[n-i] % D)
            * (facts[n] * factsi[j] % D * factsi[n-j] % D)) % D;
    }
    println!("{}",ans);
}


Measured memory_bytes: 12540
from heapq import heapify, heappush, heappop

N, M, *A = map(int, open(0).read().split())

Q = [-a for a in A]
heapify(Q)
for _ in range(M):
    a = heappop(Q)
    heappush(Q, -(-a // 2))
print(-sum(Q))


Measured memory_bytes: 14180
#include<bits/stdc++.h>
using namespace std;
char s[110];
int main()
{
	int c=1000,f=-1;
	scanf("%s",&s);
	for(int i=0;i<strlen(s);i++)
	{
		if(s[i]=='C'&&c>i)c=i;
		if(s[i]=='F'&&f<i)f=i;
	}
	if(c<f)printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}
func AbsInt(x int) int {
  if x < 0 { x = -x }
  return x
}

func StrInt(S string) []int {
  A := make([]int, len(S))
  for i, s := range S {
    if s == '?' {
      A[i] = 1 << uint(26) - 1
    } else {
      A[i] = 1 << uint(int(s) - int('a'))
    }
  }
  return A
}

func RelMatch(A, B []int) []bool {
  M := make([]bool, 4 * N)
  RA := make([]int, 5 * N)
  for i := range RA { RA[i] = 1 << uint(26) - 1 }
  for i, a := range A { RA[i + 2 * N] = a }
  Top:
    for i := range M {
      for j, b := range B {
        if RA[i + j] & b == 0 { continue Top }
      }
      M[i] = true
    }
  return M
}

const N = 2000

func Solve() {
  a := NextLine()
  b := NextLine()
  c := NextLine()
  A, B, C := StrInt(a), StrInt(b), StrInt(c)
  AB := RelMatch(A, B)
  AC := RelMatch(A, C)
  BC := RelMatch(B, C)
  ans := len(A) + len(B) + len(C)
  for i, ab := range AB {
    if !ab { continue }
    for j, ac := range AC {
      if !ac || 2 * N <= AbsInt(j - i) || !BC[j - i + 2 * N] { continue }
      ans = MinInt(MaxInt(2 * N + len(A), i + len(B), j + len(C)) - MinInt(2 * N, i, j), ans)
    }
  }
  Write(ans)
}

func main() {
  Solve()
  Output()
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int i,j,k;

int main(){
    ll n,max=0,max2;cin>>n;
    vector<ll> a(n);
    for(i=0;i<n;i++){
        cin>>a[i];
        if(max<a[i]){
            max=a[i];
        }
    }//maxを記録

    vector<ll> ans(n,max);
    
    ll key=-1;
    max2=-1;
    ll cnt=0;
    for(i=0;i<n;i++){
        if(max2<a[i] && a[i]!=max){
            max2=a[i];
        }
        if(a[i]==max){key=i;cnt++;}//maxの場所と個数を記録
    }
    
    if(max2!=-1 && cnt<=1){ans[key]=max2;}
    //maxが二つ以上なら全てmaxを出力する
    //一つだけなら、そこを選択したときのみmax2を出力する
    for(i=0;i<n;i++){
        cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 4736
#include<bits/stdc++.h>
#define rep(i,a) for(int i=0;i<a;i++)
using namespace std;
int main(){
    int n,k;
    int ans=0;
    cin>>n>>k;
    int x[n];
    rep(i,n){
        cin>>x[i];
    }
    rep(i,n){
        ans+=min(x[i],k-x[i])*2;
    }
    cout<<ans<<endl;
}

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


int main(){
  int X;
  cin >> X;
  vector<bool> A(X+1, 0);
  int ans = 1;
  for(int ii=2; ii<=X; ii++){
    if(A[ii] == false){
      for(int jj=ii*ii; jj<=X; jj*=ii){
        A[jj] = true;
      }
    }else{
      ans = ii;
    }
  }
  cout << ans << endl;
  return 0;
}

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
    sort(ALL(S));
    cout << (S == "abc" ? YES : NO) << endl;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  int n;
  long long h,w;
  long long c = 0;
   
  cin >> h >> w;
     
  if ((h == 1)||(w == 1)) cout << 1 << endl;
  else cout << (h*w+1)/2 << endl;
}

Measured memory_bytes: 256
P=2019
S = input()
N=len(S)

ans = 0

if P in (2, 5):
    for i, s in enumerate(S):
        if int(s) % P == 0:
            ans += i + 1
else:
    count = [0] * P
    count[0] = 1
    u = 0
    for i, s in enumerate(reversed(S)):
        u = (int(s) * pow(10, i, P) + u) % P
        ans += count[u]
        count[u] += 1

print(ans)



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

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

  vector<int> a(n), b(n);
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];

  priority_queue<int> que;
  queue<int> need;
  int answer = 0;
  for (int i = 0; i < n; i++) {
    if(a[i] > b[i]) que.push(a[i] - b[i]);
    else if(a[i] < b[i]) {
      need.push(b[i] - a[i]);
      answer++;
    }
  }

  while(true) {
    int x = que.top();
    que.pop();
    int sub = 0;

    bool flag = false;
    while(!need.empty()) {
      flag = true;
      sub = need.front();
      need.pop();
      if(sub >= x) {
        sub = sub - x;
        need.push(sub);
        break;
      } else {  
        x -= sub;
      }
    }

    if(flag) answer++;
    if(!need.empty() && que.empty()) {
      answer = -1;
      break;
    } else if(need.empty()) {
      break;
    }
  }
  cout << answer << "\n";
  return 0;
}


Measured memory_bytes: 4368
use proconio::input;

#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars, Usize1};
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::ops::*;

#[derive(Clone, Debug, Default)]
struct Struct;

/**
 * 現在のa,b,c の値
 * 現在の移動方向 a固定
 * 次の移動方向 next固定
 * bcのどちらに1を足すかを返す
 */
fn f( _a:&mut i32, b:&mut i32, c:&mut i32, next:i32 ) -> i32 {
    if *b == 1 && *c == 1 {
        if next == 2 {
            *b += 1;
            *c -= 1;
            1
        } else {
            *b -= 1;
            *c += 1;
            2
        }
    } else {
        if *b < *c {
            *b += 1;
            *c -= 1;
            1
        } else {
            *b -= 1;
            *c += 1;
            2
        }
    }
}


//#[proconio::fastout]
fn main() {
    input! {
        n: usize,
        mut a: i32,
        mut b: i32,
        mut c: i32,
        s: [String;n],
    }

    let mut v = Vec::with_capacity(n+1);
    for i in 0..n {
        v.push(
            match s[i].as_str() {
                "AB" => 2,
                "BC" => 0,
                "AC" => 1,
                _=>panic!(),
            },
        );
    }

    v.push( 0 );
    let mut ans = Vec::with_capacity(n);
    for i in 0..n {
        //println!("{} {} {} {}", a, b, c, v[i]);
        let r = match v[i] {
            0 => f(&mut a,&mut b,&mut c,v[i+1]),
            1 => (f(&mut b,&mut c,&mut a,(v[i+1]+3-1)%3)+1)%3,
            2 => (f(&mut c,&mut a,&mut b,(v[i+1]+3-2)%3)+2)%3,
            _ => panic!(),
        };
        if a < 0 || b < 0 || c < 0 {
            println!("No");
            return;
        }
        ans.push(r);
    }
    println!("Yes");
    for i in 0..n {
        println!("{}", match ans[i] {
            0 => "A",
            1 => "B",
            2 => "C",
            _ => panic!(),
        });
    }
}


Measured memory_bytes: 8604
import sys
import collections

n = int(input())


list = []
for i in range(26):
    list.append([0] * n)

for i in range(n):
    str = input()
    for c in str:
        a = ord(c) - ord("a")
        list[a][i] += 1

for i, l in enumerate(list):
    # print(i, l)
    print(chr(i + 97) * min(l), end="")
print()

sys.exit(0)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  int N;
  ll K;
  cin >> N >> K;
  vector<ll> A(N);
  rep(i, N) {
    cin >> A[i];
    A[i]--;
  }
  vector<bool> vis(N);
  vector<int> depth(N);
  int tmp = 0;
  int prev;
  int dep = 0;
  while(!vis[tmp]) {
    vis[tmp] = true;
    depth[tmp] = dep;
    prev = tmp;
    tmp = A[tmp];
    dep++;
    K--;
    if(K == 0) {
      cout << tmp+1 << endl;
      return 0;
    }
  }
  int loopDepth = depth[prev] - depth[tmp] + 1;
  K %= loopDepth;
  if(K == 0) {
    cout << tmp+1 << endl;
    return 0;
  }
  while(K > 0) {
    tmp = A[tmp];
    K--;
    if(K == 0) {
      cout << tmp+1 << endl;
      return 0;
    }
  }
  return 0;
}


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

int main() {

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

	if (A > 9 || B > 9) {
		cout << -1 << endl;
	}
	else {
		cout << A * B << endl;
	}
	

	return 0;
}

Measured memory_bytes: 256
import sys
from functools import reduce
sys.setrecursionlimit(10**6)


def main():

    def gcd(a, b):
        return a if b == 0 else gcd(b, a % b)

    def lcm_base(x, y):
        return (x * y) // gcd(x, y)

    def lcm(*numbers):
        return reduce(lcm_base, numbers, 1)

    n, m = map(int, input().split())
    a = list(map(int, input().split()))

    a0 = a[0]
    p = 0
    while a0 % 2 == 0:
        a0 //= 2
        p += 1
    elm = 2**p

    for ai in a:
        if (ai/elm) % 2 != 1:
            print(0)
            return

    lcm = lcm(*a)
    ans = (2*m+lcm) // (lcm*2)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14748
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

S = input()
'''
f_cnt = b_cnt = 0
for m in S:
    if m != 'T':
        break
    f_cnt += 1

for m in S[::-1]:
    if m != 'S':
        break
    b_cnt += 1
print(max(f_cnt, b_cnt) * 2)
'''
s_cnt = 0
for m in S:
    if m == 'S':
        s_cnt += 1
    elif m == 'T' and s_cnt > 0:
        s_cnt -= 1

print(2*s_cnt)

Measured memory_bytes: 3496
#include <stdio.h>
int main(void){
	int n;
	scanf("%d",&n);
	int count[4][3][10]={};
	int b,f,r,v;
	for(int i=1;i<=n;i++){
		scanf("%d %d %d %d",&b,&f,&r,&v);
		count[b-1][f-1][r-1]+=v;
	}
	for(int k=0;k<4;k++){
		for(int i=0;i<3;i++){
			for(int j=0;j<10;j++){
				if(j<10) printf(" ");
				if(count[k][i][j]==0) printf("0");
				else printf("%d",count[k][i][j]);
			}
		    putchar('\n');
		}
		if(k<3){
	    		for(int j=1;j<=20;j++){
				putchar('#');
			}
			putchar('\n');
		}
	}
	return 0;
}


Measured memory_bytes: 2068