akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner

import scala.collection.mutable.ArrayBuffer

//しゃくとり法
object Main {
  def read(): (Int, Int, String) = {
    val sc = new Scanner(System.in)
    val n, k = sc.nextInt()
    val s = sc.next()
    (n, k, s)
  }

  case class RunLengthElem[T](nRepeats: Int, elem: T)

  def compressRunLength[T](s: IndexedSeq[T]): IndexedSeq[RunLengthElem[T]] = {

    var currentChar = s(0)
    var currentCount = 1
    val buf = ArrayBuffer.empty[RunLengthElem[T]]
    for (i <- 1 until s.length) {
      if (currentChar == s(i)) {
        currentCount += 1
      } else {
        buf.append(RunLengthElem(currentCount, currentChar))
        currentChar = s(i)
        currentCount = 1
      }
    }
    buf.append(RunLengthElem(currentCount, currentChar))
    buf.toIndexedSeq
  }


  def solve(n: Int, k: Int, s: String): Int = {
    // s.length == n
    val runLength = compressRunLength(s)

    def cut(i: Int) = Math.min(i, runLength.length)

    case class Range(begin: Int, end: Int)

    // i番目が0: i, i+1,...,i+2k-1
    // i番目が1: i, i+1,...,i+2k
    val inchWorm = runLength.indices
      .map(i =>
        if (runLength(i).elem == '0') Range(i, cut(i + 2 * k))
        else Range(i, cut(i + 2 * k + 1)))

    def sum(range: Range): Int = (range.begin until range.end).map(i => runLength(i).nRepeats).sum

    // あとで添え字消去する
    val sumList =
      (1 until inchWorm.length).scanLeft(sum(inchWorm(0))) {
        case (acc, currentIdx) =>
          val beforeRange = inchWorm(currentIdx - 1)
          val currentRange = inchWorm(currentIdx)
          val lackedRange = Range(beforeRange.begin, currentRange.begin)
          val addedRange = Range(beforeRange.end, currentRange.end)
          // acc == sum(beforeRange)
          acc - sum(lackedRange) + sum(addedRange)
      }
    sumList.max
  }


  def main(args: Array[String]): Unit = {
    val (n, k, s) = read()
    println(solve(n, k, s))
  }
}

Measured memory_bytes: 73256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int MOD = 1000000007;
int INF = numeric_limits<int>::max() / 2;


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

  int N;
  cin >> N;
  int A[N+1] = {};
  for(int i=2;i<=N;i++){
    int M = i;
    for(int j=2;j*j<=i;j++){
      while(true){
        if(M % j == 0){
          M /= j;
          A[j]++;
        }
        else break;
      }
      if(M == 1) break;
    }
    if(M != 1){
      A[M]++;
    }
  }
  int ans = 1;
  for(int i=2;i<=N;i++){
    ans *= A[i]+1;
    ans %= MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
def showList(A, N):
    for i in range(N-1):
        print(A[i],end=' ')
    print(A[N-1])

def get_intlist(A):
    list_int = [int(x[1:]) for x in A]
    return list_int 

def bubbleSort(A, N):
    """
    バブルソート
    O(n^2)のアルゴリズム
    """
    B = get_intlist(A)
    flag = 1
    count = 0
    while flag:
        flag = 0
        for i in range(N-1, 0, -1):
            if B[i] < B[i-1]:
                v = A[i]
                A[i] = A[i-1]
                A[i-1] = v

                v = B[i]
                B[i] = B[i-1]
                B[i-1] = v
                flag = 1
    return A

def selectionSort(A, N):
    """
    選択ソート
    O(n^2)のアルゴリズム
    """
    B = get_intlist(A)
    for i in range(N):
        minj = i
        for j in range(i,N):
            if B[j] < B[minj]:
                minj = j
        if minj != i:
            t = B[minj]
            B[minj] = B[i]
            B[i] = t

            t = A[minj]
            A[minj] = A[i]
            A[i] = t
    return A

N = int(input())
A = [x for x in input().split(' ')]
A_ss = A.copy()
bub = bubbleSort(A,N)
showList(bub,N)
print('Stable')
sel = selectionSort(A_ss,N)
showList(sel,N)
if sel == bub:
    print('Stable')
else:
    print('Not stable')


Measured memory_bytes: 5628
#include <iostream>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <climits>
#include <numeric>
#include <queue>
#include <cmath>
#include <iomanip>
#include <array>
#include <string>
#include <stack>
#include <cassert>
#include <memory>

int main() {
	int a, v; std::cin >> a >> v;
	int b, w; std::cin >> b >> w;
	long long int t; std::cin >> t;
	if (std::abs(a - b) <= t * (v - w)) {
		std::cout << "YES\n";
	}
	else {
		std::cout << "NO\n";
	}
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string A, B;
  cin >> A >> B;
  string ans = "EQUAL";
  bool equal = true;
  if (A.size() > B.size())
  {
    ans = "GREATER";
  }
  else if (A.size() < B.size())
  {
    ans = "LESS";
  }
  else
  {
    for (int i = 0; i < A.size(); i++)
    {
      if (A[i] != B[i])
      {
        int a = A[i] - '0';
        int b = B[i] - '0';
        if (a > b)
        {
          ans = "GREATER";
        }
        else
        {
          ans = "LESS";
        }
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main()
{
	int N = 0, X = 0, ans = 0;
	std::cin >> N >> X;

	std::vector<int> L(N);
	for (int i = 0; i < N; i++){
		std::cin >> L[i];
	}

	int D = 0;
	for (ans = 1; ans <= N; ans++){
		D += L[ans - 1];
		if (D > X){
			break;
		}
	}

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#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 FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

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

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

    int N;
    cin >> N;
    vector<int> H(N);
    REP(i, N) cin >> H[i];

    int dp[N];
    dp[0] = 0;

    FOR(i, 1, N) {
        dp[i] = INF32;
        chmin(dp[i], dp[i - 1] + abs(H[i] - H[i - 1]));
        if (1 < i)
            chmin(dp[i], dp[i - 2] + abs(H[i] - H[i - 2]));
    }

    cout << dp[N - 1] << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int_inf 1000000000 //1e9
#define ll_inf  1000000000000000000 //1e18

using namespace std;






int main(){
	int n, a;
	cin >> n >> a;
	
	for(int i=0; i<=a; i++){
		if((n-i)%500==0){
			cout<<"Yes"<<endl;
			return 0;
	}}
	
	cout << "No" << endl;
	
	
	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000



int main(){
	
	long long N,A,B,C,D;
	cin>>N>>A>>B>>C>>D;
	
	A-=B;
	
	for(long long i=0;i<=N-1;i++){
		long long L = C*i - D*(N-1-i);
		long long R = D*i - C*(N-1-i);
		if(L<=A&&A<=R){
			cout<<"YES"<<endl;
			return 0;
		}
	}
	
	cout<<"NO"<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(){

	string str;

	cin>>str;


	int flag=0;

	for(int i=0;i<str.length();i++){
		if(flag==0){
			if(str.at(i)=='C'){
				flag=1;
			}
		}
		else if(flag==1){
			if(str.at(i)=='F'){
				flag=2;
			}
		}
		else{
			break;
		}
	}

	if(flag==2){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}

	return 0;

}

Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <string>
#include <ios>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	long long K, A, B;
	cin >> K >> A >> B;

	long long ans = 0;
	if ( K > A && B - A > 2 && K >= 2) {
		K = K - (A + 1);
		long long a_num = K / 2;
		long long k_num = K % 2;
		ans = a_num * (B-A) + B;
		ans += k_num;
	}
	else {
		ans = K + 1;
	}
	cout << ans;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(v) v.begin(), v.end()
using namespace std;

string s;

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> s;

    if( s=="ABC" ){
        cout << "ARC";
    }else{
        cout << "ABC";
    }

    return 0;
}


Measured memory_bytes: 3612
x,y=map(int,input().split())
if x//y>=1 and x%y==0:
    print(-1)
    exit()
a=x*(y-1)
b=x*(y+1)
t=1000000000000000000
if a>0 and a%y and a<=t:
    print(a)
elif b>0 and b%y and b<=t:
    print(b)
else:
    print(-1)


Measured memory_bytes: 38384
n=int(input())
w=input()
l=0
r=0
m=0
for i in range(n):
  if w[i]=="(":
    l+=1
  else:
    r+=1
  m=max(m,r-l)
if m==0:
  if l>r:
    print(w+")"*(l-r))
  else:
    print("("*(r-l)+w)
else:
  if l>r:
    print("("*m+w+")"*(m+l-r))
  else:
    if l+m>r:
      print("("*m+w+")"*(-r+l+m))
    elif l+m==r:
      print("("*m+w)
    else:
      print("("*(r-l-m)+w)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
const int N=200005;
#define inf 1e18+8
const int mod=1e9+7;
#define pii pair<int, int>
#define vi vector<int>
#define vf vector<float>
#define sz(x) x.size()
#define float double
#define set multiset
//#define all((int)x) begin(x), end(x)
#define vpii vector<pair<int,int> > 
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
float dp[3001][3001];
int n;
float arr[N];
float rec(int heads,int tails)
{
    if(heads==0 && tails==0) return 1;
    if(heads<0 || tails<0 ) return 0;
    if(dp[heads][tails]!=-1) return dp[heads][tails];
   // if((heads+tails)<1 || (heads+tails)>n) return 0;
   //  cout<<(p[heads+tails]*rec(heads-1,tails)+(1-p[heads+tails])*rec(heads,tails-1));
    return dp[heads][tails]=(arr[heads+tails]*rec(heads-1,tails)+(1-arr[heads+tails])*rec(heads,tails-1));

}
signed main()
{
    ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
      //std::cout << std::setprecision(10);
    for(int i=0;i<3001;i++)
    {
        for(int j=0;j<3001;j++)
        {
            dp[i][j]=-1;
        }
    }
    cin>>n;
 //   p.resize(n+1);
    for(int i=1;i<=n;i++)
    {
        cin>>arr[i];
        //cout<<p[i];
    }
   // rec(n,0);
  /*  for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        {
            cout<<dp[i][j];
        }
        cout<<"\n";
    }
        */
    float ans=0.0;
    int h=n;
    int t=0;
    while(true)
    {
       // cout<<rec(h,t);
        if(t>=h) break;
        ans+=rec(h,t);
        t++; h--;


    }
    std::cout << std::setprecision(12) << ans << '\n';
    //cout<<ans<<"\n";
    
        

        

    

    

}
 
    

Measured memory_bytes: 70912
#include<bits/stdc++.h>
using namespace std;
#define ll  long long int
ll a,b,c,x,y,i,j,k,cnt,l;
ll ar[200005];
int main()
{
    ios_base::sync_with_stdio(false);
    ll test;
    cin>>test>>a;
    for(i=1;i<=a;i++)cin>>b,test-=b;
    if(test>=0)cout<<test<<endl;
    else
        cout<<-1<<endl;

    return 0;
}



Measured memory_bytes: 3552
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
 
int main()
{
    int H, W;
    int h, w;
 
    while (1) {
        scanf("%d%d", &H, &W);
        if (H == 0 && W == 0) break;
        for (h = 0; h < H; h++) {
            for (w = 0; w < W; w++) putchar('#');
            putchar('\n');
        }
        putchar('\n');
    }
    return 0;
}


Measured memory_bytes: 2112
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef queue<P> Q;

#define _CRT_SECURE_NO_WARNINGS

string S, T;
char c[30] = {};
bool f[30] = {};
int main() {
	cin >> S >> T;
	for (int i = 0; i < S.size(); i++) {
		if ( (!f[T[i]-'a'] &&c[S[i] - 'a']==0) || c[S[i] - 'a'] == T[i] ) {
			c[S[i] - 'a'] = T[i];
			f[T[i]-'a'] = true;
		}
		else {
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 776
#include <iostream>
#include <string>
#include <complex>

using namespace std;

// typedef complex<int> comp;

class comp : public complex<int> {
public:
    comp() : complex<int>() {}
    comp(complex<int> const& c) {
        real(c.real()), imag(c.imag());
    }
    bool overflow;
};

int const lim = 10000;
bool check(comp const& c) {
    return (c.real() > lim || c.real() < -lim || c.imag() > lim || c.imag() < -lim);
}

comp operate(const comp &a, const comp &b, char o) {
    comp c;
    if (o == '+') {
        c=a+b;
    } else if (o == '-') {
        c=a-b;
    } else /* if (0 == '*') */ {
        c=a*b;
    }
    c.overflow = a.overflow || b.overflow ? true : check(c);
    return c;
}

comp expr(string&);
comp term(string&);
comp fctr(string&);

comp expr(string &s) {
    comp a = term(s);
    while (s[0] == '+' || s[0] == '-') {
        char o = s[0];
        s.erase(0, 1);
        comp b = term(s);
        a = operate(a, b, o);
    }
    return a;
}

comp term(string &s) {
    comp a = fctr(s);
    while (s[0] == '*') {
        s.erase(0, 1);
        comp b = fctr(s);
        a = operate(a, b, '*');
    }
    return a;
}

comp fctr(string &s) {
    comp z;
    z.overflow = false;
    if (s[0] == '(') {
        s.erase(0, 1);
        z = expr(s);
        s.erase(0, 1);
        return z;
    }

    int sign = 1;
    if (s[0] == '+')
        s.erase(0, 1);
    else if (s[0] == '-') {
        s.erase(0, 1);
        sign = -1;
    }

    if (s[0] == 'i') {
        s.erase(0, 1);
        z.imag(sign);
        return z;
    }

    int i = 0;
    while (s[i] >= '0' && s[i] <= '9') {
        z.real(z.real() * 10 + s[i] - '0');
        i++;
        if (z.real() > lim) z.overflow = true;
    }
    z.real(z.real()*sign);
    s.erase(0, i);
    return z;
}

 void print(const comp &z) {
     if (z.imag() == 0){
         cout << z.real() << endl;
     } else if (z.real() == 0) {
         cout << z.imag() << "i" << endl;
     } else {
         cout << z.real();
         if (z.imag() > 0)
             cout << "+";
         cout << z.imag() << "i" << endl;
     }
 }

 int main() {
     string s;
     while (cin >> s) {
         comp z = expr(s);
         if (z.overflow)
             cout << "overflow" << endl;
         else
             print(z);
     }
 }

Measured memory_bytes: 1220
using System;
using System.Collections.Generic;
class Program
{

    static void Main()
    {
        string[] LRd = Console.ReadLine().Split(' ');
        int L = int.Parse(LRd[0]);
        int R = int.Parse(LRd[1]);
        int d = int.Parse(LRd[2]);
        int count=0;

        for(int i=L;i<=R;i++)
        {
            if(i%d==0)
            {
                count++;
            }
        }

        Console.WriteLine(count);
    }

}

Measured memory_bytes: 27384
#include<iostream>
#include<math.h>
using namespace std;
int n, m, q;
int a[52], b[52], c[52], d[52];
int ans = 0;
int seq[11];

void dfs(int len, int cur){
	if(len == n){
		int sum = 0;
		for(int i = 0; i<q; i++){
			if(seq[b[i]-1] - seq[a[i]-1] == c[i]){
				sum += d[i];
			} 
		}
		ans = max(ans, sum);
		return;
	}
	else{
		seq[len] = cur;
		for(int i = cur; i<=m; i++){
			dfs(len+1, i);
		}
	}
}

int main(){
	cin >> n >> m>> q;
	for(int i = 0; i<q; i++){
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}
	dfs(0,1);
	cout << ans;
	return 0; 
	
} 


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

int cnt[MAX_N] = {};

signed main()
{
    int N, K;
    cin >> N >> K;
    int ind = 0;
    while(N > 0) {
        cnt[ind]++;
        N--;
        ind++;
        if(ind >= K) { ind = 0; }
    }
    int max_k = 0, min_k = LLINF;
    REP(i, K) {
        max_k = max(max_k, cnt[i]);
        min_k = min(min_k, cnt[i]);
    }
    printf("%lld\n", abs(max_k - min_k));
    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;
long long MOD = 1000000007LL;
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define endl "\n"

int main() {
	int N, K;

	cin >> K >> N;
	vector<int> A(N);

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

	int maxDist = A[0] + (K - A[A.size() - 1]);
	int position = 0;
	for (int i = 1; i < A.size(); ++i) {
		maxDist = max(maxDist, A[i] - A[i - 1]);
	}

	cout << K - maxDist << endl;

	return 0;
}



Measured memory_bytes: 1024
//Practice
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll N = 2e5 + 5;
const ll INF = 1e9 + 5;
const ll mxN = 1000000007;
const double E = 1e-9;

//------------------------------------------------------------------------------
ll n;
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	/*ifstream cin("input.txt");
	ofstream cout("output.txt");*/
	/*vector<ll> a;
	for(ll i=26; i<=1000000000000001; i*=26)
		a.push_back(i);*/
	cin >> n;
	string ans = "";
	while (n > 0)
	{
		--n;
		ans += (n % 26) + 'a';
		n /= 26;
	}
	reverse(ans.begin(), ans.end());
	cout << ans;
	return 0;
}
//29-08-2020 10:40:06
//------------------------------------------------------------------------------

Measured memory_bytes: 3604
abc_list = ['A','B','C','D','E','F','G','H','I','J','K','L',
            'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']


n = int(input())
abc_input = input()
abc_each = list(abc_input) #入力
#print (abc_each)

ans_abc = []
for abc in abc_each :
    for i,j in enumerate(abc_list) :
        if abc == j :
            num = (i+n) % 26
            ans_abc.append(abc_list[num])
            #print (abc_list[num])

answer = ''

for x in ans_abc:
    answer += x

print(answer)


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
long long int mod = 1e9+7;
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
//////////////////////////////////

int main(){
    int n; cin >> n;
    map<string, long long> m;
    for(int i=0; i<n; i++) {
        string s; cin >> s;
        sort(s.begin(), s.end());
        m[s]++;
    }

    long long cnt = 0;
    for(auto i=m.begin(); i!=m.end(); i++) {
        long long tmp = i->second * (i->second-1);
        cnt += tmp / 2;
    }
    cout << cnt << endl;
    
    return 0;
}

// EOF



Measured memory_bytes: 11136
k = int(input())

import math
ans = 0
ans1 = 0
ans2 = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        ans1 += math.gcd(i,j)

ans = ans + ans1*3

for i in range(1,k+1):
    for j in range(1,i):
        for l in range(1,j):
            ans2 += math.gcd(math.gcd(i,j),l)

ans += ans2*6
print(ans-sum(list(range(k+1)))*2)


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

int main(void){
    int ans = 0;
    int n;
    cin >> n;
    int m = n;
    int l = 0;
    while(m != 0){
        ans += m % 10;
        m /= 10;
        l++;
    }
    if(pow(10,l-1) == n) ans = 10;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
import static java.lang.Math.*;

import java.util.Scanner;
public class Main{
	static double sum,count=0;
	static double round;
	static Scanner sc=new Scanner(System.in);
	static Main app=new Main();


	void  SUM(double pay,double much ){
		sum+=pay*much;
		round+=much;
		count++;
	}
	void ROUND(double temp){
		temp/=count;
		round=round(temp);
	}

	private static void SystemOut(){
		System.out.println((int)sum);
		System.out.println((int)round);
	}


	public static void main(String[] args) {
		sum=0;
		while(sc.hasNext()){
			String a[]=sc.next().split(",");
			app.SUM(Double.parseDouble(a[0]),Double.parseDouble(a[1]));
		}
		
		app.ROUND(round);
		app.SystemOut();

	}
	

}

Measured memory_bytes: 17148
#include<iostream>
using namespace std;
int main(){
	int x,i,sum=0;
	cin>>x;
	i=x;
	while(x>0){
		sum=sum+x%10;
		x=x/10;
	}

	if(i%sum==0){
			cout<<"Yes"<<endl;
	}
	else cout<<"No"<<endl;
	return 0;
}

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

const int VAL[3] = {300000, 200000, 100000};

int x, y;

signed main(){
	cin >> x >> y;
	--x; --y;
	int ans = 0;
	if(x < 3) ans += VAL[x];
	if(y < 3) ans += VAL[y];
	if(x == 0 && y == 0) ans += 400000;
	cout << ans;
}

Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	s := getNextString(scanner)

	n := len(s)
	dp := make([][2]int, n+1)
	dp[1][0] = 1
	dp[2][1] = 1
	for i := 1; i < n; i++ {
		for j := 0; j < 2; j++ {
			for k := 0; k < 2; k++ {
				if i+1 > n {
					continue
				}
				if i-j-(k+1) < 0 {
					continue
				}
				if s[i-j:i+1] == s[i-j-(k+1):i-j] {
					continue
				}
				if dp[i+1][j] < dp[i-j][k]+1 {
					dp[i+1][j] = dp[i-j][k] + 1
				}
			}
		}
	}
	ans := 0
	for i := 0; i < 2; i++ {
		if ans < dp[n][i] {
			ans = dp[n][i]
		}
	}

	fmt.Fprintln(writer, ans)
	writer.Flush()
}


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

ll dy = 5*1e15;
int main(){
	string s;
	cin>>s;
	int k;cin>>k;

	ll pt = 0;
	for(int i = 0; i < (int)s.length(); i++){
		ll t = s[i] - '0';
		if(t == 1) t+=pt;
		else t = (ll)t*dy+pt;
		if(t>=k){
			cout<<s[i];
			return 0;
		}
		pt = t;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    int n; cin >> n;
    vector<ll> a(n);
    int m1 = 0;
    int m2 = 0;
    int m4 = 0;
    int cnt = 0;

    rep(i,n){
        cnt = 0;
        cin >> a[i];

        rep(j,2){
            if(a[i] %2 == 0 && a[i] != 0){
                cnt++;
                a[i] /= 2;
            }
        }

        if(cnt == 2) m4++;
        if(cnt == 1) m2++;
        if(cnt == 0) m1++;
    }

    if(m2 == 0){
        if(m4 >= m1 - 1){
            cout << "Yes" << endl;
            return 0;
        }
        else{
            cout << "No" << endl;
            return 0;
        }
    }

    if(m1 <= m4) cout << "Yes" << endl;
    else cout << "No" << endl;
}



Measured memory_bytes: 1024
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]
cd = [list(map(int,input().split())) for i in range(m)]
min = 5e+8
c = 0

for i in range(n):
    for j in range(m):
        d = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        if d<min:
            min=d
            c = j+1
    min = 5e+8
    print(c)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N, M; cin >> N >> M;
  vector<ll> A(N);
  ll cnt = 0;
  for (ll i = 0; i < N; i++) {
    cin >> A.at(i);
    cnt += A.at(i);
  }
  ll sel = 0;
  for (ll i = 0; i < N; i++) {
    if (4 * M * A.at(i) >= cnt) sel += 1;
  }
  cout << (sel >= M ? "Yes" : "No") << endl;
  

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <climits>
#define M 1000000007
#define ll long long
#define LIM 100000
using namespace std;
ll v[LIM];
int main() {
  ll cnt;
  int s, k, x, y, z;
  cin >> k >> s;
  for (int i = 0; i <= s && i <= k; i++) {
    for (int m = i; m <= s; m++) {
      x = i;
      y = m - i;
      z = s - m;
      if (x <= k && y <= k && z <= k && x + y + z == s) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
fun main() {
    val s = next()
    val t = next()
    var cnt = 0
    for (i in s.indices) {
        if (s[i] != t[i]) cnt++
    }
    println(cnt)
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(' ')
fun nextIntList() = nextList().map { it.toInt() }
fun nextLongList() = nextList().map { it.toLong() }
fun nextDoubleList() = nextList().map { it.toDouble() }


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

int main(){
	int N;
	cin >> N;
	vector<long long> A(N);
	for(auto &i:A)cin >> i;
	
	sort(A.begin(),A.end());
	reverse(A.begin(),A.end());
	
	long long a=0,b=0;
	for(int i=0;i<N-1;i++){
		if(A[i]==A[i+1]){
			if(a==0)a=A[i];
			else if(b==0)b=A[i];
			i++;
		}
	}
	cout << a*b << endl;
	return 0;
}

Measured memory_bytes: 1024
X,N=map(int,input().split())
if N==0:
    print(X)
else:
    a = list(map(int,input().split()))
    res = 10**9
    mi = 10**9
    for val in range(200,-100,-1):
        if val not in a:
            tmp = abs(X-val)
            if res >= tmp:
                res = tmp
                mi = val
    print(mi)

Measured memory_bytes: 9196
#if 0
date +%Y.%m.%d

题解先咕着。
#endif
#include <cstdio>
#include <queue>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;
typedef std::pair<int, int> Par;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	template<class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read;

const int maxn = 100010;
int head[maxn], nxt[maxn << 1], to[maxn << 1], hp = 1;
int a[maxn];
bool get[maxn];

inline void add(int u, int v) {
	nxt[++ hp] = head[u];
	head[u] = hp;
	to[hp] = v;
}

int main() {
	int n = read;

	for(int i = 1; i < n; i ++) {
		int u = read, v = read;
		add(u, v);
		add(v, u);
	}

	std::priority_queue<Par> qu;

	int k = read;
	while(k --) {
		int u = read;
		read(a[u]);
		qu.push(Par(- a[u], u));
		get[u] = 1;
	}

	while(!qu.empty()) {
		int u = qu.top().second;
		qu.pop();

		for(int i = head[u]; i; i = nxt[i]) {
			int v = to[i];
			if(get[v] and a[v] != a[u] + 1 and a[v] != a[u] - 1)
				return puts("No"), 0;
			if(!get[v]) {
				a[v] = a[u] + 1;
				get[v] = 1;
				qu.push(Par(- a[v], v));
			}
		}
	}

	puts("Yes");
	for(int i = 1; i <= n; i ++)
		printf("%d\n", a[i]);
}


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

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    //高橋
    while(true){
        c -= b;
        if(c <= 0){
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if(a <= 0){
            cout << "No" << endl;
            break;
        }
    }
    return 0;

}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ut i=(a);i<(ut)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat //cout << __LINE__ << endl;
#define int LL
using namespace std;
typedef long long LL;
typedef double ld;
typedef int ut;
typedef complex<int> cli;
typedef vector<ut> VI;
typedef pair<double,int> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
const int SIZE=5+1e6;
const LL INF=1LL<<60;
int solve(int x,int y){
	if(x<=y) return y-x;
	return INF;
}
signed main(){
	int x,y;
	int ans=INF;
	cin >> x >> y;
	cout << min(min(solve(x,y),solve(-x,-y)+2),min(solve(-x,y)+1,solve(x,-y)+1)) << endl;
}

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

using namespace std;

class Team{
public:
	string name;
	int point;
	int pos;
	
	bool operator <(const Team arg) const{
		if(point > arg.point){
			return true;
		}else if(point < arg.point){
			return false;
		}else{
			if(pos < arg.pos){
				return true;
			}else{
				return false;
			}
		}
	}
};

int main(void){
	int n;
	vector<Team> v;
	Team t;
	bool first = true;
	
	while(cin >> n && n){
		string str;
		int w,l,d;
		
		if(!first) cout << endl;
		
		for(int i=0;i<n;i++){
			cin >> str >> w >> l >> d;
			t.name = str;
			t.point = w*3+d;
			t.pos = i;
			v.push_back(t);
		}
	
		sort(v.begin(),v.end());
		
		for(int i=0;i<n;i++){
			cout << v[i].name << "," << v[i].point << endl;
		}
		first = false;
		v.clear();
	}
}

Measured memory_bytes: 0
#include<stdio.h>
#include<limits.h>

int compTimes = 0;

void merge(int A[], int left, int mid, int right){
	int n1 = mid - left;
	int n2 = right - mid;
	int L[n1+1], R[n2+1];
	int i, j, k;
	for( i = 0; i < n1; i++ ){ L[i] = A[left+i]; }
	for( i = 0; i < n2; i++ ){ R[i] = A[mid+i]; }
	L[n1] = INT_MAX;
	R[n2] = INT_MAX;
	i = 0;
	j = 0;
	for( k = left; k < right; k++ ){
		compTimes++;
		if( L[i] <= R[j] ){
			A[k] = L[i++];
		}else{
			A[k] = R[j++];
		}
	}
	return;
}

void mergeSort(int A[], int left, int right){
	if( left+1 <  right ){
		int mid = (left + right) / 2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);
	}
	return;
}

int main(){
	int n, S[500000], i;
	scanf("%d", &n);
	for( i = 0; i < n; i++ ){ scanf("%d", &S[i]); }
	mergeSort(S, 0, n);
	printf("%d", S[0]);
	for( i = 1; i < n; i++ ){ printf(" %d", S[i]); }
	printf("\n");
	printf("%d\n", compTimes);
	return 0;
}

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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,j,N) for(int i = (N-1);i >= (j);i--)
#define ALL(x) x.begin(),x.end()
#define PB push_back
#define LL long long

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {
    _for(i,0,v.size()) os << v[i] << " ";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){
    for(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}

LL B[51];
LL P[51];

void init(){
    B[0] = 1;
    P[0] = 1;

    _for(i,1,51){
        B[i] = 2*B[i-1] + 3;
        P[i] = 2*P[i-1] + 1;
    }
}

LL N,X;

LL searching(int n,LL x){
    LL ret_val = 0;
    LL b = B[n];
    if(x >= b) return P[n];
    x--;
    LL b2 = B[n-1];

    if(x){
        if(x >= b2){
            x -= b2;
            ret_val += searching(n-1,b2);
        }
        else{
            ret_val += searching(n-1,x);
            x = 0;
        }
    }

    if(x){x--;ret_val++;}
    if(x){
        ret_val += searching(n-1,x);
    }
    return ret_val;
}

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

    cout << searching(N,X) <<endl;

    return 0;
}

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

using namespace std;
int main() {
    int n;
    long long l = 1;
    long long l_pre = 1;
    long long l_prepre = 2;

    cin >> n;

    for (int i = 2; i <= n; i++) {
        l = l_pre + l_prepre;
        l_prepre = l_pre;
        l_pre = l;
    }

    cout << l << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
using llong = long long;

struct node {
        int l, r, u, d;
        char dir;
};

using pi = pair<int, int>;
map<int, set<pi>> x_axis;
map<int, set<pi>> y_axis;
vector<node> nodes;
int n;
int X[3005], Y[3005];
char d;

void build() {
        for (int i = 1; i <= n; i++) {
                int x = X[i];
                int y = Y[i];
                nodes[i].r = (x_axis[y].upper_bound(pi(x, 100000)))->second;
                nodes[i].d = (y_axis[x].upper_bound(pi(y, 100000)))->second;

                {
                        auto itr = x_axis[y].lower_bound(pi(x, -1));
                        itr--;
                        nodes[i].l = itr->second;
                }
                {
                        auto itr = y_axis[x].lower_bound(pi(y, -1));
                        itr--;
                        nodes[i].u = itr->second;
                }
        }
}

int dfs(int u) {
        if (u == 0) return 0;

        nodes[nodes[u].u].d = nodes[u].d;
        nodes[nodes[u].d].u = nodes[u].u;
        nodes[nodes[u].l].r = nodes[u].r;
        nodes[nodes[u].r].l = nodes[u].l;

        switch(nodes[u].dir) {
                case '^' :
                        return dfs(nodes[u].u) + 1;
                        break;
                case 'v' :
                        return dfs(nodes[u].d) + 1;
                        break;
                        break;
                case '<' :
                        return dfs(nodes[u].l) + 1;
                        break;
                case '>' :
                        return dfs(nodes[u].r) + 1;
                        break;
        }
        return 0;
}

int main() {
        cin >> n;
        nodes.resize(n + 1);
        for (int i = 1; i <= n; i++) {
                cin >> X[i] >> Y[i] >> d;
                int x = X[i];
                int y = Y[i];
                nodes[i].dir = d;

                if (x_axis.count(y) == 0) {
                        x_axis[y].insert(pi(-1000000001, 0));
                        x_axis[y].insert(pi(1000000001, 0));
                }
                if (y_axis.count(x) == 0) {
                        y_axis[x].insert(pi(-1000000001, 0));
                        y_axis[x].insert(pi(1000000001, 0));
                }

                x_axis[y].insert(pi(x, i));
                y_axis[x].insert(pi(y, i));
        }

/*
        build();
        for (int i = 1; i <= n; i++) {
                printf("%d %d %d %d", nodes[i].l, nodes[i].r, nodes[i].u, nodes[i].d);
                cout << endl;
        }
        */

        int ans = 0;
        for (int i = 1; i <= n; i++) {
                build();
                ans = max(ans, dfs(i));
        }
        cout << ans << endl;
}



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

int main(){
  int a,b;
  cin>>a>>b;
  if(a%3==0 || b%3==0 || (a+b)%3==0){
    cout<<"Possible"<<endl;
  }else{
    cout<<"Impossible"<<endl;
  }
}

Measured memory_bytes: 384
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
f=min(a,b,c,d,e)
g=max(a,b,c,d,e)
h=g-f
if h <= k:
  print('Yay!')
else:
  print(':(')


Measured memory_bytes: 3060
#include <iostream>
#include <array>
#include <algorithm>
#include <map>
#include <iostream>
#include <vector>]
#include <cmath>
using namespace std;

int main()
{
	int judge;
	cin >> judge;
	for (int i = 1; i <= 9; i++)
	{
		for (int j = 1; j <= 9; j++)
		{
			if (i * j == judge)
			{
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

const int mod = 1000000007;
struct mint {
	long long x; // typedef long long ll;
	mint(long long x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(long long t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// 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 {
		mint res(*this);
		return res /= a;
	}
};

Measured memory_bytes: 256
#ifdef Prateek
  #include "C:\Prateek.h"
#else
  #include <bits/stdc++.h>
  using namespace std;
  #define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 3e5 + 10; 

int t[4*N];

int sum(int v, int tl, int tr, int l, int r) {
    if (l > r) 
        return 0;
    if (l == tl && r == tr) {
        return t[v];
    }
    int tm = (tl + tr) / 2;
    return max(sum(v*2, tl, tm, l, min(r, tm))
          , sum(v*2+1, tm+1, tr, max(l, tm+1), r));
}

void update(int v, int tl, int tr, int pos, int new_val) {
    if (tl == tr) {
        t[v] = new_val;
    } else {
        int tm = (tl + tr) / 2;
        if (pos <= tm)
            update(v*2, tl, tm, pos, new_val);
        else
            update(v*2+1, tm+1, tr, pos, new_val);
        t[v] = max(t[v*2] , t[v*2+1]);
    }
}

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int n, k;
   cin >> n >> k;
   vector<int> A(n);
   for(int i = 0; i < n; ++i) {
      cin >> A[i];
   }
   int ans = 1;
   for(int i = n-1; i >= 0; --i) {
      int mn = max(0ll, A[i]-k);
      int mx = min(N-1, A[i]+k);
      int q = sum(1, 0, N-1, mn, mx);
      ans = max(ans, q+1);
      update(1, 0, N-1, A[i], q+1);
   }
   cout << ans << '\n';
   return 0;
} 

Measured memory_bytes: 13812
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
const int MAX_N = 100010;
struct UnionFind{
    int par[MAX_N];
    void init(int n){
        for(int i = 0;i < n;i++)par[i] = i;
    }
    int root(int x){
        if(par[x] == x)return x;
        else return par[x] = root(par[x]);
    }
    bool same(int x,int y){
        return root(x) == root(y);
    }
    void unite(int x,int y){
        x = root(x);
        y = root(y);
        if(x == y)return;
        par[y] = x;
    }
};
main(){
    int N,M;
    cin >> N >> M;
    vector<int> V(N);
    rep(i,0,N){
        cin >> V[i];
        V[i]--;
    }
    UnionFind uf;
    uf.init(N);
    rep(i,0,M){
        int a,b;
        cin >> a >> b;
        uf.unite(a-1, b-1);
    }
    int cnt = 0;
    rep(i,0,N){
        if(uf.same(V[i], i) )cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main()
{
  int a,b,tmp,r;
  scanf("%d %d",&a,&b);
  //a>bを確認
  if(a<b){
    tmp=a;
    a=b;
    b=tmp;
  }
  
  //ユークリッドの互除法
  r=a%b;
  while(r!=0){
    a=b;
    b=r;
    r=a%b;
  }
  printf("%d\n",b);
  return 0;
}



Measured memory_bytes: 2104
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const ll MOD = 1000000007;
using namespace std;

int main(){
    int n; cin >> n;
    cout << 800*n - 200*(n/15) << "\n";
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [0] + list(map(int, input().split()))
ans = []
for i in range(n, 0, -1):
    j = 2 * i
    while j <= n:
        a[i] ^= a[j]
        j += i
    if a[i] == 1:
        ans.append(i)
print(len(ans))
if ans:
    print(' '.join(list(map(str, ans))))

Measured memory_bytes: 94420
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int N, A[1010][1010];
vector<int> G[1010 * 1010];

int to_v(int x, int y) {
    if(x > y) swap(x, y);
    return x * N + y;
}

int main() {
    cin >> N;

    int all_match = N * N;
    vector<int> indeg(all_match), info(all_match);
    for(int i=0; i<N; i++) {
        for(int j=0; j<N-1; j++) {
            cin >> A[i][j]; A[i][j]--;
        }
        for(int j=1; j<N-1; j++) {
            int u = to_v(i, A[i][j-1]);
            int v = to_v(i, A[i][j  ]);
            // fprintf(stderr, "%d (%d, %d) => %d (%d, %d)\n", u, i, A[i][j-1], v, i, A[i][j]);
            G[u].emplace_back(v);
            indeg[v]++;
        }
    }

    queue<int> que;
    for(int i=0; i<all_match; i++) {
        if(indeg[i] == 0) {
            que.emplace(i);
            info[i] = 1;
        }
    }

    while(que.size()) {
        int cur = que.front(); que.pop();
        for(auto to : G[cur]) {
            chmax(info[to], info[cur] + 1);
            if(--indeg[to] == 0) {
                que.emplace(to);
            }
        }
    }

    for(int i=0; i<all_match; i++) {
        if(indeg[i]) {
            cout << -1 << endl;
            return 0;
        }
    }

    cout << *max_element(info.begin(), info.end()) << endl;
    return 0;
}


Measured memory_bytes: 53632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    ll a; cin >> a;
    string b; cin >> b;
    ll c = (b[0]-'0') * 100 + (b[2] - '0') * 10 + (b[3] - '0');
    cout << a * c / 100 << endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
vector<long long>num;
int main(){
 int numm,nummer,menge;
cin>>numm;
for(int i=1;i<10;i++){
	for(int j=1;j<10;j++){
		if(i*j==numm){
			cout<<"Yes";
			return 0;
		}
	}
}
cout<<"No";
 return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL N;
	in >> N;
	std::vector<LL>a(N);
	rep(i, N) in >> a[i];

	std::map<LL, LL>cnt;
	rep(i, N) ++cnt[a[i]];
	bool ans = false;
	if (cnt.size() == 3)
	{
		LL b[3];
		LL d[3];
		LL c = 0;
		for (auto i : cnt)
		{
			b[c] = i.second;
			d[c] = i.first;
			++c;
		}

		std::sort(b, b + 3);

		if (N % 3 == 0 && ((d[0]^d[1])==d[2])&&((d[0]^d[2])==d[1])&&((d[1]^d[2])==d[0]))
		{
			if (b[0] == b[1] && b[1] == b[2] && b[0] == b[2]) ans = true;
		}
	}
	if (cnt.size() == 2)
	{
		LL b[2];
		LL d[2];
		LL c = 0;
		for (auto i : cnt)
		{
			b[c] = i.second;
			d[c] = i.first;
			++c;
		}

		std::sort(b, b + 2);
		std::sort(d, d+ 2);
		if (N % 3 == 0)
		{
			if (cnt[d[1]] == cnt[d[0]] * 2 && d[0] == 0) ans = true;
		}
	}
	if (cnt.size() == 1)
	{
		if (cnt[0] == N) ans = true;
	}

	out << (ans ? "Yes" : "No") << std::endl;
}


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

int main(){
  ll n,i,k;
  cin >> n >> k;
  vector<pair<ll,ll>> ab(n);
  for(i=0;i<n;++i){
    ll a,b;
    cin >> a >> b;
    ab[i]=make_pair(a,b);
  }
  sort(ab.begin(),ab.end());
  ll num=0;
  ll ans=0;
  i=0;
  while(k>num){
    if(num+ab[i].second<k){
      num=num+ab[i].second;
    }else{
      ans=ab[i].first;
      num=num+ab[i].second;
    }
    i++;
  }
  cout << ans << endl;
  return 0;

}


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


using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  = 3.141592653589793238463;
const int N = 1e5+10;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}


// Main Code


int main()
{
	string s;
	cin>>s;
	ll i =0;
	ll k;
	cin>>k;
	k--;
	while(s[i] == '1' && i < s.length()) i++;
	if(i == s.length()) cout<<'1'<<endl;
	else if(k >= i) cout<<s[i]<<endl;
	else if(k < i)
	{
		cout<<'1'<<endl;
	}
}


Measured memory_bytes: 256
#include<cstdio>

using namespace std;

int main(void){
	int masu[110][110];
	int uramasu[110][110];
	while(1){
		for(int i=0;i<110;i++){
			for(int j=0;j<110;j++){
				masu[i][j]=0;
				uramasu[i][j]=0;
			}
		}
		
		int n,m;
		int c;
		
		scanf("%d%d",&n,&m);
		if(n==0 && m==0){
			break;
		}
		
		scanf("%d",&c);
		
		for(int i=0;i<c;i++){
			int a,b;
			scanf("%d%d",&a,&b);
			uramasu[a][b]=1;
		}
		
		masu[1][1]=1;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
				if(uramasu[i][j]==0){
					masu[i+1][j]+=masu[i][j];
					masu[i][j+1]+=masu[i][j];
				}
			}
		}
		
		
		printf("%d\n",masu[n][m]);
		
}
}

Measured memory_bytes: 0