akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    Map<Integer, List<String>> seq = new HashMap<>();
    for (int i = 0; i < n; i++) seq.put(i, new ArrayList<String>());
    for (int i = 0; i < m; i++) {
      int p = sc.nextInt();
      String s = sc.next();
      seq.get(p -1).add(s);
    }
    int ac = 0;
    int wa = 0;
    for (List<String> history : seq.values()) {
      int wai = 0;
      for (String s : history) {
        if (s.equals("WA")) wai++;
        else {
          wa += wai;
          ac += 1;
          break;
        }
      }
    }
    System.out.printf("%d %d\n", ac, wa);
  }
}

Measured memory_bytes: 60924
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mx 100000000
#define pb push_back
#define mp make_pair
#define YES cout<<"YES\n";
#define Yes cout<<"Yes\n";
#define NO cout<<"NO\n";
#define No cout<<"No\n";
#define all(v) (v).begin(),(v).end()


ll md=1e9+7;
ll __gcd(ll a, ll b) {if(b==0) return a; return __gcd(b, a%b);}
ll poww(ll a, ll b) {ll res=1;while(b) {if(b&1){res*=a;res%=md;}a*=a;a%=md;b>>=1;}return res;}
void ainp(int arr[], int n) {for(int i=0;i<n;i++) cin>>arr[i];}

const ll N=3e5+5;

void fun()
{ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);}


signed main()
{  
fun();
int t;
//cin>>t;
t=1;
while(t--)
{
	ll n,d,i,c=0,p,q;
	cin>>n>>d;
	for(i=0;i<n;i++)
	{
		cin>>p>>q;
		if((p*p+q*q)<=d*d)
		c++;
	}
cout<<c;
}
}



Measured memory_bytes: 3572
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<stack>
#include<algorithm>
#include<queue>
#include<string>
#define OK 1
#define INF 2147483647
#define LINF 9223372036854775807LL
#define DINF 100000000
#define LL long long
using namespace std;
typedef struct
{
	int cnt[4][4];
}HNode;
vector<HNode>H[366][4][4];
int n,map[365][4][4];
int biao[4][4][4][2];
const int di[] = { 0, 0, 0, -1, -2, 0, 0, 1, 2 };
const int dj[] = { 0, -1, -2, 0, 0, 1, 2, 0, 0 };
bool dfs(int cur, int ci, int cj, int cnt[4][4]);
bool judge(int cur, int ci, int cj, int cnt[4][4]);

int main()
{
	int i,j,k,cnt[4][4];
	while (scanf("%d", &n) > 0)
	{
		if (n == 0) break;
		for (k = 0; k < n; k++)
		{
			for (i = 0; i < 4; i++)
			{
				for (j = 0; j < 4; j++) H[k][i][j].clear();
			}
		}
		for (k = 0; k < n; k++)
		{
			for (i = 0; i < 4; i++)
			{
				for (j = 0; j < 4; j++) scanf("%d", &map[k][i][j]);
			}
		}
		for (i = 0; i < 4; i++)
		{
			for (j = 0; j < 4; j++) cnt[i][j] = 1;
		}
		cnt[1][1] = cnt[1][2] = cnt[2][1] = cnt[2][2] = 0;
		judge(0, 1, 1, cnt);
		if (dfs(0, 1, 1, cnt) == true) printf("1\n");
		else printf("0\n");
	}
	return 0;
}

bool judge(int cur, int ci, int cj, int cnt[4][4])
{
	int k,j,i, len;
	bool flag = false;
	HNode e;
	for (k = 0, len = H[cur][ci][cj].size(); k < len; k++)
	{
		e = H[cur][ci][cj][k];
		flag = true;
		for (i = 0; i < 4; i++)
		{
			for (j = 0; j < 4; j++)
			{
				if (e.cnt[i][j] != cnt[i][j]) flag = false;
			}
		}
		if (flag == true) break;
	}
	if (flag == false)
	{
		for (i = 0; i < 4; i++)
		{
			for (j = 0; j < 4; j++) e.cnt[i][j] = cnt[i][j];
		}
		H[cur][ci][cj].push_back(e);
		return false;
	}
	else return true;
}

bool dfs(int cur,int ci,int cj,int cnt[4][4])
{
	int k,next_ci,next_cj,i,j,nextCnt[4][4];
	if (map[cur][ci][cj] == 1 || map[cur][ci][cj + 1] == 1 || map[cur][ci + 1][cj] == 1 || map[cur][ci + 1][cj + 1] == 1) return false;
	if (cur == n - 1)  return true;
	for (k = 0; k < 9; k++)
	{
		next_ci = ci + di[k];
		next_cj = cj + dj[k];
		if (next_ci < 0 || next_ci + 1 >= 4 || next_cj < 0 || next_cj + 1 >= 4) continue;
		memcpy(nextCnt, cnt, sizeof(nextCnt));
		for (i = 0; i < 4; i++)
		{
			for (j = 0; j < 4; j++) nextCnt[i][j]++;
		}
		nextCnt[next_ci][next_cj] = nextCnt[next_ci][next_cj + 1] = 0;
		nextCnt[next_ci + 1][next_cj] = nextCnt[next_ci + 1][next_cj + 1] = 0;
		bool flag = true;
		for (i = 0; i < 4; i++)  //判断下雨天数
		{
			for (j = 0; j < 4; j++)
			{
				if (nextCnt[i][j] == 7) flag = false;
			}
		}  
		if (flag == false) continue;
		if (judge(cur + 1, next_ci, next_cj, nextCnt) == true) continue;
		if (dfs(cur + 1, next_ci, next_cj, nextCnt) == true) return true;
 	}
	return false;
}

Measured memory_bytes: 17088
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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

bool done[100010];
int
main(void){  
  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int ans = 0;
  string s;
  int n_one = 0, n_zero = 0;
  cin >> s;
  /* 
  bool one = (s[0] == '1' ? true : false);
  n_one = (s[0] == '1' ? 1 : 0);
  n_zero = (s[0] == '0' ? 1 : 0);
  */
  REP(i, s.size()){
    if(s[i] == '1') n_one++;
    else n_zero++;
  }
  ans = min(n_one, n_zero);
  cout << ans*2 << endl;
  
  return 0;
}



Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define endl  "\n"
#define ll long long
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);cout.tie(NULL);
using namespace std;
bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i += 6)
    {
        if ((n % i == 0) || (n % (i + 2) == 0))
            return false;
    }
    return true;
}
int mod=1e9+7;
int32_t main()
{
	int t=1;
	while(t--)
	{
		int n;
		cin >> n;
		int a[n];
		int pref[n]={0};
		int suf[n]={0};
		for(int i=0;i<n;i++)
		{
			cin >> a[i];
			pref[i]=a[i];
			
			suf[i]=a[i];
		}
		
		for(int i=0;i<n;i++)
		{
			pref[i]+=pref[i-1];
			pref[i]%=mod;
			
		}
		for(int i=n-2;i>=0;i--)
		{
			suf[i]+=suf[i+1];
			suf[i]%=mod;
		}
		int ans=0;
		for(int i=0;i<n-1;i++)
		{
			ans+=(a[i]*suf[i+1]);
			ans%=mod;
		}
		cout << ans;
	}
}




Measured memory_bytes: 8276
# https://atcoder.jp/contests/tenka1-2019-beginner/tasks/tenka1_2019_c

n = gets.to_i
stones = gets.chomp.chars
res = []

total_black = stones.count('#')
total_white = stones.count('.')
left_black = 0
right_white = total_white

0.upto(stones.size) do |idx|
  res << right_white + left_black
  c = stones[idx]
  left_black += 1 if c == '#'
  right_white -= 1 if c == '.'
end
# p res
puts res.min


Measured memory_bytes: 18428
// G++ MACRO.CPP -STD=C++17
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair

int main(){
  LCIN(n,m);


  ll ok = 0; ll ng = LINF;

  auto f = [&](ll p){
    //p個つくる
    ll s = max(0LL, p - n);
    ll t = m;

    t -= (2 * s);

    return t/2 >= p;

  };

  while(abs(ok-ng)>1){

    ll num = (ok+ng)/2;

    (f(num)?ok:ng) = num;

  }
  COUT(ok);

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main(){
int n, bill;
 
while(cin>>n,~n){
bill = 1150;
n-=10;
if(n<0)n=0;
if(n>10){bill += 125*10; n -= 10;}
else{bill += 125*n; n = 0;}
if(n>10){bill += 140*10; n -= 10;}
else{bill += 140*n; n = 0;}
bill += 160*n;
 
cout<<4280-bill<<endl;
}
 
return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,y;
    cin>>x>>y;
    if(4*x<y||y%2==1)
        cout<<"No"<<endl;
    else
    {
        int sum=4*x;
        while(sum!=y&&x--)
        {
            sum-=2;
        }
        if(x!=-1)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3620
#!/usr/bin/env python3
import sys
import bisect 

def solve(N: int, L: int):
    li = [i for i in range(L,L+N)]

    # print(li)
    if(L < 0 and L+N-1 <= 0):
        print(sum(li)-li[-1])
    elif(L < 0 and L+N-1 > 0):
        print(sum(li))
    elif(L >= 0):
        print(sum(li) - li[0])

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    L = int(next(tokens))  # type: int
    solve(N, L)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	a := scanInts(n)
	b := scanInts(n)

	memo1 := make([][]int, 30)
	memo2 := make([][]int, 30)

	for i := 0; i < 30; i++ {
		abit1 := make([]int, n*2)
		abit2 := make([]int, n*2)
		bbit := make([]int, n)
		for j := 0; j < n; j++ {
			abit1[j] = a[j] >> uint(i) & 1
			abit2[j] = abit1[j] ^ 1
			abit1[j+n] = abit1[j]
			abit2[j+n] = abit2[j]
			bbit[j] = b[j] >> uint(i) & 1
		}
		bbit = append(bbit, -1)

		memo1[i] = zalgorithm(append(bbit, abit1...))[n+1 : n+n+1]
		memo2[i] = zalgorithm(append(bbit, abit2...))[n+1 : n+n+1]
	}

	var dfs func(k, b, x int)
	dfs = func(k, b, x int) {
		if b < 0 {
			fmt.Fprintln(wr, k, x)
			return
		}
		if memo1[b][k] == n {
			dfs(k, b-1, x)
		}
		if memo2[b][k] == n {
			dfs(k, b-1, x+1<<uint(b))
		}
	}

	for i := 0; i < n; i++ {
		dfs(i, 29, 0)
	}

}

func zalgorithm(s []int) []int {
	n := len(s)
	res := make([]int, n)
	i, j := 1, 0
	for i < n {
		for i+j < n && s[j] == s[i+j] {
			j++
		}
		res[i] = j
		if j == 0 {
			i++
			continue
		}
		k := 1
		for i+k < n && k+res[k] < j {
			res[i+k] = res[k]
			k++
		}
		i += k
		j -= k
	}
	return res
}


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

vector<int> G[MAX_V];
vector<int> score(MAX_V,0),d(MAX_V,1);

void dfs(int i, int ad_score){
    d.at(i)=0;
    score.at(i)+=ad_score;
    for(auto p:G[i]){
        if(d.at(p)) dfs(p,score.at(i));
    }
}

void input_graph(int E){
    REP(i,E){
        int s,t;
        cin>>s>>t;s--;t--;
        G[s].push_back(t);
        G[t].push_back(s);
    }
}

int main(){
    int V,q;cin>>V>>q;
    input_graph(V-1);

    REP(i,q){
        int p,x;cin>>p>>x;p--;
        score.at(p)+=x;
    }

    dfs(0,0);

    REP(i,V) cout<<score.at(i)<<" ";
}




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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<string> vs;
typedef vector<vs> table;
typedef vector<vl> v2;
typedef vector<v2> v3;
typedef vector<v3> v4;


const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;

ll n;
string s;
vl a;
ll x;
void error(){
  cout << 0 << endl;
  exit(0);
}
ll factorial(ll n,ll mod = mod){
  ll ret = 1;
  for(ll i = 1;i <= n;i++){
    ret *= i;
    ret %= mod;
  }
  return ret;
}

ll ans = 1;

int main(){
  cin >> n;
  cin >> s;
  a = vl(2*n);
  for(ll i = 0;i < 2*n;i++){
    ll d;
    if(((x+1000000)%2 == 0 && s[i] == 'B') || ((x+1000000)%2 == 1 && s[i] == 'W')) d = 1;
    else d = -1;
    a[i] = d;
    x += d;

  }
  if(x != 0) error();
  ll mem = 0;
  for(ll i = 0;i < 2*n;i++){
    if(a[i] == 1) mem++;
    else{
      ans *= mem;
      ans %= mod;
      mem--;
    }
  }
  ans *= factorial(n);
  ans %= mod;
  cout << ans << endl;


}


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

string g[101010];
int main() {
    int n, k, r, s, p;
    string t;
    cin >> n >> k >> r >> s >> p >> t;
    rep(i, n) g[i % k] += t[i];
    int ans = 0;
    rep(i, k) {
        int m = g[i].size();
        vector<vector<int>> dp(m, vector<int>(3, 0));
        if (g[i][0] == 'r') dp[0][2] = p;
        if (g[i][0] == 's') dp[0][0] = r;
        if (g[i][0] == 'p') dp[0][1] = s;

        for (int j=1;j<m;++j) {
            dp[j][2] = max(dp[j-1][0], dp[j-1][1]);
            dp[j][0] = max(dp[j-1][1], dp[j-1][2]);
            dp[j][1] = max(dp[j-1][2], dp[j-1][0]);

            if (g[i][j] == 'r') dp[j][2] += p;
            if (g[i][j] == 's') dp[j][0] += r;
            if (g[i][j] == 'p') dp[j][1] += s;
        }
        int h = max(dp[m-1][0], dp[m-1][1]);
        h = max(h, dp[m-1][2]); 
        ans += h;
    }
    cout << ans << endl;
}




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

int main(int args, char *argv[])
{
  int N;
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    string s;
    cin >> s;

    if (s == "Y")
    {
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
  return 0;
}


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

namespace ABC068A
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();

            Console.WriteLine("ABC" + str);

            Console.ReadKey();
                 
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 35;
const int MAXK = 510;
const int MAXQ = 200010;

int A[1010][1010];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int a, b;
    cin >> a >> b;
    int n = 40, m = 100;
    FOR(i,1,20) FOR(j,1,m) A[i][j] = 0;
    FOR(i,21,40) FOR(j,1,m) A[i][j] = 1;
    a--; b--;
    if (b) {
        for (int i = 1; i <= 20; i += 2) {
            for (int j = 1; j <= m; j += 2) {
                A[i][j] = 1;
                b--;
                if (b == 0) break;
            }
            if (b == 0) break;
        }
    }
    
    if (a) {
        for (int i = 22; i <= n; i += 2) {
            for (int j = 1; j <= m; j += 2) {
                A[i][j] = 0;
                a--;
                if (a == 0) break;
            }
            if (a == 0) break;
        }
    }
    cout << n << ' ' << m << endl;
    FOR(i,1,n) {
        FOR(j,1,m)
            if (A[i][j]) cout << '#';
            else cout << '.';
        cout << endl;
    } 
    return 0;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
    int N, K;
    cin >> N >> K;
    int ans = 1;

    for (int i = 0; i < N; i++){
        if (2 * ans <= ans + K ){
            ans *= 2;
        }else{
            ans  += K;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))

dam = 0
for i in range(N-1):
  dam = (A[i]-(dam//2))*2
  
start = A[-1]-(dam//2)
ans = [start]

for i in range(N-1):
  ans.append((A[i] - (ans[-1] //2)) *2)
  
print(*ans, sep=" ")

Measured memory_bytes: 14028
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

int main()
{
    long N;
    std::cin >> N;
    long a[200000]={};
    for(long i=0; i<N; i++){
        std::cin >> a[i];
    }

    long goal=1;
    long result=0;
    for(long i=0; i<N; i++){
        if(goal==a[i]){
            goal++;
        }else{
            result++;
        }
    }

    if(goal==1){
        std::cout << "-1" << std::endl;
    }else{
        std::cout << result << std::endl;
    }
    return 0;
}

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

int main(){
    int a,b;    cin>>a>>b;
    int n;  cin>>n;
    int y[n][2];
    for(int i=0;i<n;i++){
        cin>>y[i][0]>>y[i][1];
    }

    int ans=0;

    for(int i=0;i<n;i++){
        for(int j=a;j<=b;j++){
            if(y[i][0]<=a&&a<y[i][1] || y[i][0]<b&&b<=y[i][1]|| a<=y[i][0]&&y[i][1]<=b){
                ans=1;
                break;
            }
        }
    }

    cout<<ans<<endl;



    return 0;
}



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

using namespace std;

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

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=acos(-1);
const ll MOD=1e9+7;
const ll INF=(1LL<<60);

int main() {
    string s;
    cin>>s;
    ll dp[2][2019];
    ll ans=0;
    ll ss=0;
    memset(dp,0,sizeof(dp));
    dp[1][0]=1;
    for (int i=0;i<s.size();i++){
        for (int j=0;j<2019;j++){
            dp[i%2][(j*10)%2019]=dp[(i+1)%2][j];
        }
        int num=s[i]-'0';
        ss=(10*ss+num)%2019;
        
        ans+=dp[i%2][ss%2019];
        dp[i%2][ss%2019]+=1;
    }
    cout<<ans<<endl;

    

    return 0;
}

Measured memory_bytes: 3760
a,b = map(int,input().split())
s = input()

num = list(map(str,list(range(10))))

flag = True
for i in range(a):
    if s[i] not in num:
        flag = False
if s[a] != "-":
    flag = False
for i in range(a+1,a+b+1):
    if s[i] not in num:
        flag = False

if flag:
    print("Yes")
else:
    print("No")
   

Measured memory_bytes: 9188
import java.io.*;

/**
 * Created by Ayushi on 10 May 2020.
 * Problem:
 * Round:
 */

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String a = br.readLine();
        String b = br.readLine();
        if ((a+b.charAt(b.length()-1)).equals(b)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
        br.close();
    }
}


Measured memory_bytes: 37028
// D - Restoring Road Network

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

const int MAX = 300;
const ll INF = 9223372036854775807;

ll A[MAX][MAX];
ll d[MAX][MAX]; // d[i][j] : 頂点iから頂点jへの最小コスト


void Warshall_Floyd(ll d[MAX][MAX], int n) {
	for (int k=0; k<n; k++) {
		for (int i=0; i<n; i++) {
			if (d[i][k] == INF) continue;
			for (int j=0; j<n; j++) {
				if (d[k][j] == INF) continue;
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}

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

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

	Warshall_Floyd(d, N);

	// i->jにA[i][j]より短い経路がある場合は -1
	for (int i=0; i<N; i++) {
		for (int j=0; j<N; j++) {
			if (d[i][j] != A[i][j]) {
				cout << -1 << endl;
				return 0;
			}
		}
	}

	// i->jにA[i][j]と同じコストの迂回路があればi->jを直接結ぶ経路は不要
	ll ans = 0;
	bool necessary;
	for (int i=0; i<N; i++) {
		for (int j=i+1; j<N; j++) {
			necessary = true;
			for (int k=0; k<N; k++) {
				if (k == i || k == j) continue;
				if (d[i][k] + d[k][j] == A[i][j]) {
					necessary = false;
					break;
				}
			}
			if (necessary) ans += A[i][j];
		}
	}

	cout << ans << endl;

	return 0;
}

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

class Main{
  public static void main(String[]args) throws IOException{
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    int N = Integer.parseInt(bf.readLine());
    int x;
    for(int i = 1; i <= N;i++){
      if(i % 3 == 0){
        System.out.printf(" %d",i);  
      }else{
        x = i;
		do{
          if(x%10 == 3){
            System.out.printf(" %d",i);
            break;
          }
		x /=10;
        }while(x != 0);
      }
    }
    System.out.println();
  }
}


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

using namespace std;

int main()
{
	int a, b, k;
	cin >> a >> b >> k;

	int cnt = 0;
	for (int i = 100; i > 0; i--) {
		if (a % i == 0 && b % i == 0) {
			cnt++;
			if (cnt == k) {
				cout << i << endl;
				break;
			}
		}
	}

	return 0;
}


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

#define DEF_ELM_MAX 2000000

typedef struct _CMD {
	char cmd[32];
	int key;
} CMD;

CMD A[DEF_ELM_MAX];

typedef	struct _Node {
	int key;
	struct _Node *prev;
	struct _Node *next;
} Node;

Node *nil;	//	??????

/////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
void init()
{
	nil = (Node *)malloc(sizeof(Node));
	nil->next = nil;
	nil->prev = nil;
}

Node* listSearch(int key)
{
	Node *cur = nil->next; // ??????????¬????????´?????????????
	while ( cur != nil && cur->key != key ) {
		cur = cur->next;
	}
	return cur;
}

void printList()
{
	Node *cur = nil->next;
	int isf = 0;
	while ( 1 ) {
		if ( cur == nil ) {
			break;
		}
		if ( isf++ > 0 ) {
			printf(" ");
		}
		printf("%d", cur->key);
		cur = cur->next;
	}
	printf("\n");
}

void deleteNode(Node *t)
{
	if ( t == nil ) {
		return; // t ??????????????´?????????????????????
	}
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t);
}

void deleteFirst()
{
	deleteNode(nil->next);
}

void deleteLast()
{
	deleteNode(nil->prev);
}

void deleteKey(int key)
{
	// ????´¢????????????????????????
	deleteNode(listSearch(key));
}

void insert(int key)
{
	Node *x = (Node *)malloc(sizeof(Node));
	x->key = key;
	// ???????????´??????????´??????????
	x->next = nil->next;
	nil->next->prev = x;
	nil->next = x;
	x->prev = nil;
}

/////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
int main(void)
{
	int i;
	int N;
	CMD *p;
//
	scanf("%d", &N);
	for ( i = 0 ; i < N ; i++ ) {
		p = &A[i];
		scanf("%s", p->cmd);
		if ( p->cmd[0] == 'd' && (p->cmd[6] == 'F' || p->cmd[6] == 'L') ) {
		} else {
			scanf("%d", &p->key);
		}
	}

	init();

	for ( i = 0 ; i < N ; i++ ) {
		p = &A[i];
		if (p->cmd[0] == 'i') {
			insert(p->key);
		} else if (p->cmd[0] == 'd') {
			if (p->cmd[6] == 'F') {
				deleteFirst();
			} else if (p->cmd[6] == 'L') {
				deleteLast();
			} else {
				deleteKey(p->key);
			}
		}
	}
	printList();

	return 0;
}

Measured memory_bytes: 102164
from collections import deque

N = int(input())
E = [[] for _ in range(N)]
for _ in range(N-1):
    a, b, c = map(int, input().split())
    E[a-1].append((b-1, c))
    E[b-1].append((a-1, c))
Q,K = map(int, input().split())
qlist = [[int(q) for q in input().split()] for _ in range(Q)]

q = deque()
q.append((K-1, 0))
d = [-1]*N
d[K-1] = 0
while q:
    temp = q.popleft()
    p = temp[0]
    r = temp[1]
    for t in E[p]:
        if d[t[0]] < 0:
            d[t[0]] = r+t[1]
            q.append((t[0], r+t[1]))
            
for i in range(Q):
    print(d[qlist[i][0]-1]+d[qlist[i][1]-1])

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

map<pair<int ,int >,int > f;
vector<int> v[1000005];
int num[1000005];
int book[1000005];
int flag=0;

void dfs(int x){
	
	if(flag==1) return ;
	
	for(int i=0;i<v[x].size();i++){
		
		int pos=v[x][i];
		
		if(book[pos]==0){
			
			book[pos]=1;
			
			num[pos]=num[x]+f[pair<int ,int >(x,pos)];
			
			dfs(pos);
			
		}else{
			
			if(num[pos]!=num[x]+f[pair<int ,int >(x,pos)]){
				flag=1;
				return ;
			}
			
		}
		
	}
	
}

int main(){
	
	int n,m;
	int l,r,d;
	
	cin>>n>>m;

	for(int i=0;i<m;i++){
		
		cin>>l>>r>>d;
		
		v[l].push_back(r);
		v[r].push_back(l);
		
		f[pair<int ,int >(l,r)]=d;
		f[pair<int ,int >(r,l)]=-d;
		
	}
	
	for(int i=1;i<=n;i++){
		
		if(flag==1){
			break;
		}
		
		if(book[i]==0){
			
			book[i]=1;
			num[i]=0;
			dfs(i);
			
		}
		
	}
	
	if(flag){
		cout<<"No"<<endl;
	}else{
		cout<<"Yes"<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 66560
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rel register ll
#define rec register char
#define gc getchar
//#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<23,stdin),p1==p2)?-1:*p1++)
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
char buf[1<<23],*p1=buf,*p2=buf;
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) pc('-'),x=-x;
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
const int aoi=3018,mod=998244353;
ll dp[aoi][aoi];
int a[aoi];
int main() {
  int i,n,j,k,s;
  read(n),read(s);
  for (i=1;i<=n;++i) a[i]=read();
  for (**dp=i=1;i<=n;++i) {
    for (j=0;j<=s;++j) {
      dp[i][j]=dp[i-1][j]*2%mod;
      if (j>=a[i]) dp[i][j]=(dp[i][j]+dp[i-1][j-a[i]])%mod;
    }
  }
  printf("%lld\n",dp[n][s]);
}

Measured memory_bytes: 74396
///////////////////////////////////////////// Template /////////////////////////////////////////////
#![allow(non_snake_case, unused_imports)]
use std::io::Write;
use std::collections::*;
use template::*;

#[macro_use]
pub mod template {
	macro_rules! debug {
	    ($($v: expr),*) => {
	    	$(let _ = write!(std::io::stderr(), "{} = {:?} ", stringify!($v), $v);)*
	        let _ = writeln!(std::io::stderr(), "@ {}:{}", file!(), line!());
	    }
	}
	macro_rules! mat {
		($e:expr) => { $e };
		($e:expr; $d:expr $(; $ds:expr)*) => { vec![mat![$e $(; $ds)*]; $d] };
	}
	pub trait FromLn {
		fn fromln(s: &str) -> Self;
	}	
	pub fn readln<T: FromLn>() -> T {
		let mut buf = String::new();
		let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
		T::fromln(buf.trim())
	}
	pub fn readlns<T: FromLn>(n: usize) -> Vec<T> {
		let mut vs = vec![];
		for _ in 0..n { vs.push(readln()); }
		vs
	}
	macro_rules! fromln_primitives {
		($($t:ty),*) => { $(
			impl FromLn for $t {
				fn fromln(s: &str) -> $t {
					s.parse().unwrap()
				}
			}
		)* }
	}
	fromln_primitives!(String, bool, f32, f64, isize, i8, i16, i32, i64, usize, u8, u16, u32, u64);
	impl<T> FromLn for Vec<T> where T: FromLn {
		fn fromln(s: &str) -> Vec<T> {
			s.split_whitespace().map(T::fromln).collect()
		}
	}
	impl FromLn for Vec<char> {
		fn fromln(s: &str) -> Vec<char> {
			s.chars().collect()
		}
	}
	macro_rules! fromln_tuple {
		($($t:ident: $i:expr),*; $n:expr) => {
			impl<$($t),*> FromLn for ($($t),*) where $($t: FromLn),* {
				fn fromln(s: &str) -> ($($t),*) {
					let ss = s.split_whitespace().collect::<Vec<_>>();
					assert_eq!(ss.len(), $n);
					($($t::fromln(ss[$i])),*)
				}
			}
		}
	}
	fromln_tuple!(A:0, B:1; 2);
	fromln_tuple!(A:0, B:1, C:2; 3);
	fromln_tuple!(A:0, B:1, C:2, D:3; 4);
	pub trait SetMin {
		fn setmin(&mut self, v: Self) -> bool;
	}
	impl<T> SetMin for T where T: PartialOrd {
		fn setmin(&mut self, v: T) -> bool {
			*self > v && { * self = v; true }
		}
	}
	pub trait SetMax {
		fn setmax(&mut self, v: Self) -> bool;
	}
	impl<T> SetMax for T where T: PartialOrd {
		fn setmax(&mut self, v: T) -> bool {
			*self < v && { * self = v; true }
		}
	}
}
fn main() {
	let _ = writeln!(std::io::stderr(), "----- {} -----", file!());
	let _ = std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}
////////////////////////////////////////////////////////////////////////////////////////////////////

fn run() {
	let n: usize = readln();
	let mut A: Vec<i32> = readln();
	A.sort();
	A.dedup();
	let d = n - A.len();
	println!("{}", A.len() - d % 2);
}


Measured memory_bytes: 8572
#include <cstdio>
#include <iostream>
#include <cmath>
#define ll long long
using namespace std;
ll A,B,C,D;
ll gcd(ll x,ll y){
	if(y==0)return x;
	return gcd(y,x%y);
}
int main(){
	cin>>A>>B>>C>>D;
	ll p=B/C-(A-1)/C+B/D-(A-1)/D,kk=C/gcd(C,D)*D;
	p-=B/kk-(A-1)/kk;
	cout<<(B-A+1-p)<<endl;;
	return 0;
}

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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
#define repp(i, start, to) for (li i = (li)(start); i < ((li)(to)); i++)

#define F first
#define S second

typedef pair<li, li> PI;

int main(void)
{
	li x;
	cin >> x;


	li res = 1;
	repp(i, 2, sqrt(x) + 1) {
		for (auto y = i * i; y <= x; y *= i) {
			res = max(res, y);
		}
	}
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 3596
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextInt());
        }
        Deque<Integer> deque = new ArrayDeque<>();
        parent: while (!list.isEmpty()) {
            for (int j = list.size() - 1; j >= 0; j--) {
                if (list.get(j) == j + 1) {
                    deque.addFirst(j + 1);
                    list.remove(j);
                    continue parent;
                }
            }
            System.out.println(-1);
            return;
        }
        while (!deque.isEmpty()) {
            System.out.println(deque.pop());
        }
    }
}

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

const int N = 200006;
vector<int> G[N];

int par[N];
int deg[N];

int main () {
    int n,m; cin >> n >> m;
    for (int i=0;i<n-1+m;++i) {
        int x,y; cin >> x >> y;
        G[x].push_back(y);
        deg[y]++;
    }
    int root = -1;
    for (int i=1;i<=n;++i) {
        if (deg[i] == 0) {
            root = i;
        }
    }
    queue<int> que;
    que.push(root);
    while (!que.empty()) {
        int t = que.front();
        que.pop();
        for (int i:G[t]) {
            --deg[i];
            if (!deg[i]) {
                par[i] = t;
                que.push(i);
            }
        }
    }
    for (int i=1;i<=n;++i) cout << par[i] << endl;
}



Measured memory_bytes: 9472
#include <set>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

set<string> s;

int main() {
  string sr, ls;
  int n;
  scanf("%d", &n);
  cin >> ls;
  s.insert(ls);
  for (int i = 2; i <= n; ++i) {
    cin >> sr;
    if (s.find(sr) != s.end()) {
      puts("No");
      return 0;
    }
    if (sr[0] != ls[ls.length() - 1]) {
      puts("No");
      return 0;
    }
    ls = sr;
    s.insert(sr);
  }
  puts("Yes");
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define x first
#define y second

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 998244353;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;

int n;
ll arr[200100];
ll cnt[1000100];
ll scnt[1000100];
ll dab[1000100];
ll mo[1000100];

ll ipow(ll a, ll n) {
    if (!n) return 1;
    ll t= ipow(a,n/2);
    return t*t%MOD*(n%2?a:1)%MOD;
}

int main() {
    scanf("%d",&n);
    for (int i=0;i<n;i++) {
        scanf("%lld",&arr[i]);
        cnt[arr[i]]=(cnt[arr[i]]+arr[i])%MOD;
        scnt[arr[i]]=(scnt[arr[i]]+arr[i]*arr[i]%MOD)%MOD;
    }
    for (int i=1;i<=1000000;i++) {
        for (int j=i*2;j<=1000000;j+=i) {
            cnt[i]+=cnt[j];
            scnt[i]+=scnt[j];
        }
        cnt[i]%=MOD;
        scnt[i]%=MOD;
        dab[i] = (cnt[i]*cnt[i]%MOD-scnt[i])*((MOD+1)/2)%MOD;
        dab[i] = (dab[i]+MOD)%MOD;
    }
    mo[1] = 1;
    for (int i=1;i<=1000000;i++) {
        for (int j=2*i;j<=1000000;j+=i) mo[j]-=mo[i];
    }
    ll ans = 0;
    for (int g=1;g<=1000000;g++) {
        ll tmp = 0;
        for (int k=1;k*g<=1000000;k++) {
            tmp+=mo[k]*dab[k*g];
        }
        tmp = (tmp%MOD+MOD)%MOD;
        ans += tmp*ipow(g,MOD-2)%MOD;
    }
    printf("%lld\n",(ans%MOD+MOD)%MOD);

	return 0;
}


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

typedef long long int ll;
using namespace std;
using namespace __gnu_pbds;
#define fastio ios_base::sync_with_stdio(false);cout.tie(0);cin.tie(0);

typedef tree< pair < ll, ll >, null_type, less< pair < ll, ll > >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const ll mod = 998244353;
const ll MAXN = 1e5+5;
const ll inf = 1e18;

int main()
{
    fastio;
    ll n;
    cin >> n;
    vector < ll > a(n + 1);
    for(int i = 1; i <= n; i++) cin >> a[i];
    vector < bool > used(n + 1, false);
    ll u = 1, cnt = 0;
    for( ; ; ){
        if(u == 2){
            cout << cnt << endl; break;
        }
        if(used[u]){
            cout << -1 << endl; break;
        }else{
            used[u] = true;
            u = a[u];
            cnt++;
        }
    }
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
 
#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second
 
int main(int argc, char **argv) {
	int n, res;
	cin >> n;
	for (res = 0; res * res <= n; ++res);
	--res;
	cout << (res * res) << endl;
	return 0;
}
 

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
    private static FastScanner sc = new FastScanner();
    private static long mod = 1000003;

    public static void main(String[] args) {
    	int Q = sc.nextInt();
    	long[] frac = new long[1000003];
    	frac[0] = 1;
    	for(int i=1; i<1000003; i++) {
    		frac[i] = frac[i-1] * i % mod;
    	}
    	for(int q=1; q<=Q; q++) {
    		long x = sc.nextLong();
    		int d = sc.nextInt();
    		long n = sc.nextLong();
    		if(d == 0) {
    			System.out.println(power(x, n));
    			continue;
    		}
    		if(n >= mod) {
    			System.out.println(0);
    			continue;
    		}
    		long k = x * power(d, mod-2) % mod;
    		if(k - 1 + n >= mod) {
    			System.out.println(0);
    			continue;
    		}
    		long ans = power(d, k - 1 + n) * frac[(int)k - 1 + (int)n] % mod;
    		ans  = (ans * power((power(d, k - 1) * frac[(int)k - 1] % mod), mod-2)) % mod;
    		System.out.println(ans);
    	}
    }

    static long power(long m , long n){
    	if(n == 0) {
    		return 1;
    	}else if(n == 1){
            return m;
        }else if(n % 2 == 0){
            long s = power(m, n/2);
            return ( (s % mod) * (s % mod) ) % mod;
        }else{
            return ( (m % mod) * (power(m, n-1) % mod) ) % mod;
        }
    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}


Measured memory_bytes: 65580
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin>>n;
	string s;
	cin>>s;
	int dp[n-1];
	int check = 0;
	rep(i,n-1){
		int a1 = s[i]-'0';
		int a2 = s[i+1]-'0';
		dp[i] = abs(a2-a1);
		if(dp[i] == 1)check = 1;
	}	
	int c = 0;
	int m = n-2;
	int x = 2;
	while(m/x>0){
		c += m/x;
		x *= 2;
	}
	// cout<<c<<"\n";
	int ans = 0;
	rep(i,n-1){
		int c1 = 0;
		int j = i;
		int x = 2;
		while(j/x > 0){
			c1 += j/x;
			x *= 2;
		}
		j = n-2-i;
		x = 2;
		while(j/x > 0){
			c1 += j/x;
			x *= 2;
		}
		c1 = c - c1;
		// cout<<c1<<" ";
		if(c1 == 0){
			ans ^= dp[i];
		}
	}
	if(ans & 1){
		cout<<1;
		return 0;
	}
	if(check){
		cout<<0;
		return 0;
	}
	rep(i,n-1){
		dp[i] /= 2;
	}
	ans = 0;
	rep(i,n-1){
		int c1 = 0;
		int j = i;
		int x = 2;
		while(j/x > 0){
			c1 += j/x;
			x *= 2;
		}
		j = n-2-i;
		x = 2;
		while(j/x > 0){
			c1 += j/x;
			x *= 2;
		}
		c1 = c - c1;
		// cout<<c1<<" ";
		if(c1 == 0){
			ans ^= dp[i];
		}
	}
	if(ans & 1){
		cout<<2;
	}
	else{
		cout<<0;
	}
	return 0;
}

Measured memory_bytes: 5276
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX_N 100000
#define MAX_M 100000
const int MAX = 10000000;
const int MOD = 1000000007;
#define vec vector<int>
#define vecll vector<ll>
#define vecllvec vector<vector<ll>>
#define vecb vector<bool>
#define vecbvecb vector<vector<bool>>
#define vecst vector<string>
#define vecch vector<char>
#define vecf vector<float>
#define vecvec vector<vector<int>>
#define vecHvec vector<vector<char>>
#define all(x) (x).begin(),(x).end()
const int INF = 1e9;
#define PI 3.141592653589793
// cout << setprecision(15) << std::fixed;

long long fac[MAX], finv[MAX], inv[MAX];

void combset() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long comb(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  ll x,y,m,n;
  cin>>x>>y;
  if((2*y-x)%3!=0||(2*x-y)%3){
    cout<<0<<endl;
    return 0;
  }
  combset();
  n=(2*y-x)/3;
  m=(2*x-y)/3;
  if(n<0||m<0){
    cout<<0<<endl;
    return 0;
  }
  cout<<comb(n+m,n)%MOD<<endl;
}


Measured memory_bytes: 234752
/*
[ ( ^ _ ^ ) ]
*/
// problem: atc/abc163_d
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD (ll)(1e9+7)
#define INF 1000000000



int main() {
    int n, k;
    scanf("%d %d", &n, &k);
    vector<ll> sum(n+1);
    for(int i=1; i<=n; i++) {
        sum[i] = i + sum[i-1];
        if(sum[i]>=MOD) sum[i] -= MOD;
    }
    ll rs = 0;
    for(int i=k; i<=n+1; i++) {
        ll minsum = sum[i-1];
        ll maxsum = sum[n] - (n-i>=0 ? sum[n-i] : 0);
        if(maxsum < 0) maxsum += MOD;
        rs += (maxsum - minsum + 1) % MOD;
        if(rs >= MOD) rs -= MOD;
        if(rs < 0) rs += MOD;
    }
    printf("%lld\n", rs);
}


Measured memory_bytes: 4860