akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;

#define int long long

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define rrep(i, s) rep(i, s, >= 0, --)

#define all(c) begin(c), end(c)

#define X first
#define Y second

template<typename T>bool maxup(T& a, T&& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool maxup(T& a, T& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool minup(T& a, T&& b) { if (a > b) { a = b; return true; }; }
template<typename T>bool minup(T& a, T& b) { if (a > b) { a = b; return true; }; }

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }

signed main() {
	const int mod = 1e9 + 7;
	int N; cin >> N;
	int ans = 1;
	rep(i, N / 2) ans = (ans * 2) % mod;
	map<int, int> mp;
	rep(i, N) {
		int a; cin >> a;
		mp[a]++;
	}
	if ((N % 2 != mp[0]) || mp[0] >= 2) ans = 0;
	for (int i = (N % 2) + 1; i < N; i += 2) {
		if (mp[i] != 2) ans = 0;
	}
	cout << ans << endl;
	system("pause");
}

Measured memory_bytes: 5624
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
// #include<bits/stdc++.h>
using namespace std;
#define ll long long
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1e8;


int main(){
  int X;
  cin >> X;
  if(X<100){
    cout << 0 << endl;
    return 0;
  }
  int a;
  if((X%100)%5 == 0){
    if(X/100 >= (X%100)/5){
      cout << 1 << endl;
      return 0;
    }else{
      cout << 0 << endl;
      return 0;
    }
  }
  if(X/100 >= ((X%100)/5)+1){
    cout << 1 << endl;
    return 0;
  }else{
    cout << 0 << endl;
    return 0;
  }

return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cassert>
#include <cmath>

using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int const nmax = 3000;
int const modulo = 1000000007;
int dp[5 + nmax][5 + nmax][2];

int main() {
  int n, m;
  std::cin >> n >> m;
  n--;
  for(int i = 0;i <= n; i++)
    dp[1][i][(i == 0)] = 1;

  for(int i = 1;i < m; i++) { 
    for(int j = 0; j <= n; j++) 
      for(int h = 0; h < 2; h++) {
        if(j < n)
          dp[i + 1][j + 1][h] += dp[i][j][h];
        if(modulo <= dp[i + 1][j + 1][h])
          dp[i + 1][j + 1][h] -= modulo;
        
        if(0 < j)
          dp[i + 1][j - 1][h | (j == 1)] += dp[i][j][h];
        if(modulo <= dp[i + 1][j - 1][h | (j == 1)])
          dp[i + 1][j - 1][h | (j == 1)] -= modulo;
        
        if(0 < i)
          dp[i + 1][j][h] += dp[i][j][h] * 2 % modulo;
        if(modulo <= dp[i + 1][j][h])
          dp[i + 1][j][h] -= modulo;
      }
  }
  int result = 0;
  for(int i = 0; i <= n; i++) {
    result += dp[m][i][1];
    if(modulo <= result)
      result -= modulo;
  }
  std::cout << result * 4LL % modulo;
  return 0;
}


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

int main() {
  int n,ans = 1;
  cin >> n;
  vector<int>data(n);
  for(int i = 0;i < n;i++){
    cin >> data.at(i);
    for(int j = 0;j < i;j++){
      if(data.at(j) == data.at(i)){
        break;
      }
      else if(j == i-1){
        ans++;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    string m[] = {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"};
    string s, t1, t2;
    cin >> s;
    t1 = s.substr(0, 2);
    t2 = s.substr(2, 2);
    ll m1 = 0, m2 = 0;
    for(ll i = 0; i < 12; i++)
    {
        if(m[i] == t1)
            m1 = 1;
        if(m[i] == t2)
            m2 = 1;
    }
    if(m1 == 1 && m2 == 0)
    {
        cout << "MMYY";
    }
    else if(m1 == 0 && m2 == 1)
    {
        cout << "YYMM";
    }
    else if(m1 == 1 && m2 == 1)
    {
        cout << "AMBIGUOUS";
    }
    else 
        cout << "NA";
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
#define LL long long
#define MAXN 300000
#define INF 100000000000000000
#define DB double
#define PI acos(-1.0)
int n;
LL k,ans;
int a[MAXN+5],f[MAXN+5];
LL read(){
  LL x=0,F=1;char c=getchar();
  while(c<'0'||c>'9'){if(c=='-')F=-1;c=getchar();}
  while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
  return x*F;
}
bool cmp(int s1,int s2){return s1>s2;}
bool check(LL x){
  LL t=0;
  for(int i=1;i<=n;i++)
  t+=max(0LL,a[i]-(x/f[i]));
  //printf("%lld\n",t);
  return t<=k;
}
int main()
{
  n=read(),k=read();
  for(int i=1;i<=n;i++)
    a[i]=read();
  for(int i=1;i<=n;i++)
    f[i]=read();
  sort(a+1,a+n+1);
  sort(f+1,f+n+1,cmp);
  LL l=0,r=INF,p;
  while(l<=r){
    LL mid=(l+r)>>1;
    if(check(mid))p=mid,r=mid-1;
    else l=mid+1;
  }
  printf("%lld",p);
}


Measured memory_bytes: 1792
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

constexpr int64_t DIV1097 = 1000000007LL;

using namespace std;

int main()
{
    int64_t N;
    std::cin >> N;

    std::map<int64_t, int64_t> one;
    std::map<int64_t, int64_t> two;

    std::vector<int64_t> V;
    for (decltype(N) i = 0; i < N; i+=2) {
        int64_t e, n;
        std::cin >> e >> n;
        one[e]++;
        two[n]++;
    }

    auto one_max_itr = std::max_element(std::begin(one), std::end(one), [](auto l, auto r) { return l.second < r.second;});
    auto two_max_itr = std::max_element(std::begin(two), std::end(two), [](auto l, auto r) { return l.second < r.second;});

    int64_t ans = 0;
    if (one.size() == 1 && two.size() == 1) {
        if (one_max_itr->first == two_max_itr->first) {
            ans = N/2;
        }else {
            ans = 0;
        }
    }
    else if (one.size() == 1) {
        ans = N/2 - two_max_itr->second;
        cerr << two_max_itr->second;
    }
    else if(two.size() == 1) {
        ans = N/2 - one_max_itr->second;
        cerr << one_max_itr->second;
    }
    else {
        if (one_max_itr->first == two_max_itr->first) {
            // 2番手探す
            auto o = *one_max_itr;
            auto t = *two_max_itr;

            one_max_itr->second = 0;
            two_max_itr->second = 0;
            auto one_bimax_itr = std::max_element(std::begin(one), std::end(one), [](auto l, auto r) { return l.second < r.second;});
            auto two_bimax_itr = std::max_element(std::begin(two), std::end(two), [](auto l, auto r) { return l.second < r.second;});

            ans = std::min(N - o.second - two_bimax_itr->second, N - t.second - one_bimax_itr->second);

        }
        else {
            ans = N - one_max_itr->second - two_max_itr->second;
        }
    }

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

    return 0;
}


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


signed main(){
    //cout << setprecision(16) ;
    ios::sync_with_stdio(false);
	cin.tie(0);

    int n,m,q;
    cin>>n>>m>>q;
    ll cnt[n][n]={};
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        a--,b--;
        cnt[a][b]++;
    }
    ll ans[n+1][n+1]={};
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            ans[i+1][j+1] += ans[i+1][j] + cnt[i][j];
        }
    }
    cerr<<endl;
    while(q--){
        int l,r;
        cin>>l>>r;
        ll ret = 0;
        for(int i=l;i<=r;i++){
            ret += ans[i][r] - ans[i][l-1];
        }
        
        cout<<ret<<"\n";
    }
}

Measured memory_bytes: 4864
#include<stdio.h>

int main(void)
{
  int n,number,max,min;
  long sum;
  scanf("%d", &n);
  scanf("%d", &number);
  max = number;
  min = number;
  sum = number;
  int i;
  for (i = 0; i < n-1; i++) {
    scanf("%d", &number);
    if (max < number) {
      max = number;
    }
    if (min > number) {
      min = number;
    }
    sum += number;
  }
  printf("%d %d %ld\n", min, max, sum);
  return 0;
}

Measured memory_bytes: 600
import java.io.*;
class Main{
public static void main(String args[]) throws IOException{
BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(buf.readLine());
StringBuilder sb = new StringBuilder();
int num = 0;
for(int j=3; j<=n; j++){
if(j%3==0){
sb.append(" "+j);
} else {
num = j;
while(num != 0){
if(num%10==3){
sb.append(" "+j);
break;
} else{
num = num/10;
}   
}
}           
}
System.out.println(sb);
}
}

Measured memory_bytes: 26160
#include <bits/stdc++.h>
#include <atcoder/all>

using namespace atcoder;

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int n, m;
    std::cin >> n >> m;
    
    std::vector<int> a(n), b(m);
    for (int i = 0; i < n; ++i)
        std::cin >> a[i];
    for (int i = 0; i < m; ++i)
        std::cin >> b[i];
    
    auto c = convolution(a, b);
    
    for (int i = 0; i < n + m - 1; ++i)
        std::cout << c[i] << " \n"[i == n + m - 2];
    
    return 0;
}

Measured memory_bytes: 19028
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        int h, w;

        while(true){
            h = scanner.nextInt();
            w = scanner.nextInt();
            if(h == 0 && w == 0)break;
            for(int i = 0; i < h; i++){
                for(int j = 0; j < w; j++)System.out.print("#");
                System.out.println("");
            }
            System.out.println("");
        }
    }
}



Measured memory_bytes: 32840
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>

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

using namespace std;

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

template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

void trace(int A[], int N) {
    for (int i = 0; i < N; ++i) {
        if (i > 0) cout << " ";
        cout << A[i];
    }
    cout << endl;
}

using ll = long long;
using P = pair<int, int>;

const unsigned long long INF = 1LL << 60;

////////////////////////////////////////////////////////////

int A, B, C;

int main() {
    cin >> A >> B >> C;

    if (A == B) {
        cout << C << endl;
    }
    if (A == C) {
        cout << B << endl;
    }
    if (C == B) {
        cout << A << endl;
    }
}


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


#define ll long long


//gcdやり直す

void swap (int *x, int *y) {
  int temp;    

  temp = *x;
  *x = *y;
  *y = temp;
}




/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
void quick_sort (int array[], int left, int right) {
  int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}






/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

int main(void){
  int n;
  scanf("%d",&n);
  n%=1000;
  printf("%d\n",(1000-n)%1000);
}

Measured memory_bytes: 1720
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a:A) cin >> a;}


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

int K; cin >> K;

i64 ans = 0;

rep(i, 1, K+1) rep(j, 1, K+1) rep(k, 1, K+1)
    ans += gcd(gcd(i, j), k);


cout << ans << "\n";

return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 問題文から考える。自分ができることから考える。
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索。逆から考える。
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 3652
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main(){
    int h,w;
    cin>>h>>w;
    vector<string> s(h);
    for(int i=0; i<h; i++){
        cin>>s[i];
    }
    int dy[2]={0,1},dx[2]={1,0};
    vector<vector<int>> dp(h,vector<int>(w,1e9));
    queue<pair<int,int>> q;
    vector<vector<int>> dist(h,vector<int>(w,-1));
    dist[0][0]=0;
    if(s[0][0]=='#') dp[0][0]=1;
    else dp[0][0]=0;
    q.push(make_pair(0,0));
    while(!q.empty()){
        auto v=q.front();
        q.pop();
        for(int i=0; i<2; i++){
            int toy=v.first+dy[i];
            int tox=v.second+dx[i];
            if(toy<0||toy>=h||tox<0||tox>=w) continue;
            
            if(s[toy][tox]=='#' && s[v.first][v.second]=='.') dp[toy][tox]=min(dp[toy][tox],dp[v.first][v.second]+1);
            else dp[toy][tox]=min(dp[toy][tox],dp[v.first][v.second]);
            
            if(dist[toy][tox]!=-1) continue;
            dist[toy][tox]=dist[v.first][v.second]+1;
            q.push(make_pair(toy,tox));
        }
    }
    cout<<dp[h-1][w-1]<<endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int dp(int now,int sum);
int n;
int a[109];
int memo[109][10009];

int main(){
  memset(memo,-1,sizeof(memo));
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  cout<<dp(0,0)<<endl;
}

int dp(int now,int sum){
  int rec=0;
  if(memo[now][sum]!=-1)return memo[now][sum];
  if(now==n){
    if(sum%10==0)return 0;
    else return sum;
  }
  rec=max(rec,dp(now+1,sum));
  rec=max(rec,dp(now+1,sum+a[now]));
  return memo[now][sum]=rec;
}
  


Measured memory_bytes: 4480
#include <iostream>
using namespace std;
int main(void)
{
    int N,i,j;
    int counter=0;
    int answer=0;
    cin>>N;
    int a[N];
    for(i=0;i<N;i++)
    {
        cin>>a[i];
    }
    for(j=0;j<N;j++)
    {
        counter++;
        if(a[j]==0)
        {
            if(counter>answer)
            {
                answer=counter;
            }
            counter=0;
        }
        if(a[j]==1)
        {
            if(counter>answer)
            {
                answer=counter;
            }
            if(j+1==N)
            {
                counter++;
                if(counter>answer)
                {
                    answer=counter;
                }
            }
        }
    }
    cout<<answer<<endl;
    return 0;
}



Measured memory_bytes: 3112
#include <iostream>
#include <vector>
#include <algorithm>
//#include <string>
using namespace std;

int main(){
    int N, L; cin >> N >> L;
    vector<string> s(N);
    for (int i=0; i<N; i++){
        cin >> s.at(i);
    }
    sort(s.begin(), s.end());
    string answer="";
    for (string t : s){
        answer+=t;
    }
    cout << answer << endl;
    return 0;
}

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

int main() {
  int A; cin >> A;  // ８％の時の税額（切り捨て
  int B; cin >> B;  // １０％の時の税額（切り捨て

  int zei8,zei10;   // 判定用税額
  int Ans = -1;     // 対象の元値
  
  // 1≦A≦B≦100。つまり、元値の最大値は1000。最小値は、13。
  // 元値ループで、zei8 == A の間、zei10 == B になる最初の値を探す。
  rep(i,1001){
    zei8 = i * 8 / 100;
    if (debug) { cout << i << ":" << zei8 << endl;}
      if ( zei8 == A ){
        zei10 = i / 10;
        if ( zei10 == B ) {
          Ans = i;
          break;
        }
      }
  }
  cout << Ans << endl;
  
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;


int main(){
    int h,w;
    std::cin >> h>>w;
    vvector(a,int,h,w,0);
    reprep(i,j,h,w)std::cin >> a[i][j];
    std::vector<string> s;
    rep(i,h){
        int di,dj;
        if(i%2==0){
            rep(j,w){
                di=i;dj=j;
                if(a[i][j]%2==1){
                    if(j==w-1&&i!=h-1){
                        di=i+1;dj=j;
                        a[i][j]--;
                        a[di][dj]++;
                    }
                    else if(j!=w-1){
                        di=i,dj=j+1;
                        a[i][j]--;
                        a[di][dj]++;
                    }
                }
            if(i!=di||j!=dj){
            s.pb(to_string(i+1));
            s[s.size()-1]+=" ";
            s[s.size()-1]+=to_string(j+1);
            s[s.size()-1]+=" ";
            s[s.size()-1]+=to_string(di+1);
            s[s.size()-1]+=" ";
            s[s.size()-1]+=to_string(dj+1);
        }    
            }
        }
        else{
            irep(j,w){
                di=i;dj=j;
                if(a[i][j]%2==1){
                    if(j==0&&i!=h-1){
                        di++;
                        a[i][j]--;
                        a[di][dj]++;
                    }
                    else if(j!=0){
                        dj--;
                        a[i][j]--;
                        a[di][dj]++;
                    }
                }
                if(i!=di||j!=dj){
            s.pb(to_string(i+1));
            s[s.size()-1]+=" ";
            s[s.size()-1]+=to_string(j+1);
            s[s.size()-1]+=" ";
            s[s.size()-1]+=to_string(di+1);
            s[s.size()-1]+=" ";
            s[s.size()-1]+=to_string(dj+1);
        }
            }
            
        }
        
    }
    std::cout << s.size() << std::endl;
    rep(i,s.size())std::cout << s[i] << std::endl;
}


Measured memory_bytes: 12788
#include <iostream>
using namespace std;
int h,w;
char a;
int main(){
    cin>>h>>w;
    int x=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>a;
            if(a=='#') x++;
        }
    }
    if(x==h+w-1) cout<<"Possible";
    else cout<<"Impossible";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
}

ll n,m;
vl a,b,dp[2];

int main(){
	cin>>n>>m;
	a=b=vl(n);
	ll N=1<<n;
	dp[0]=dp[1]=vl(N);
	for(auto &i:a) cin>>i;
	for(auto &i:b) cin>>i;
	for(int i=1;i<N;i++){
		ll t=1;
		for(int j=0;j<n;j++) if(i&1<<j){
			ll g=gcd(t,a[j]);
			if(a[j]/g<=(m+t-1)/t) t*=a[j]/g;
			else t=m+1;
			if(t>m) break;
		}
		int id=0;
		for(int j=0;j<n;j++) if(i&1<<j) id^=1;
		dp[id][i]=m/t;
	}
	for(int i=0;i<n;i++){
		vl DP[2];
		DP[0]=DP[1]=vl(N);
		for(int j=0;j<N;j++){
			DP[0][j]=dp[0][j]+(j&1<<i?dp[0][j-(1<<i)]:0);
			DP[1][j]=dp[1][j]+(j&1<<i?dp[1][j-(1<<i)]:0);
		}
		swap(dp,DP);
	}
	double res=0;
	for(int i=1;i<N;i++){
		double p=1;
		for(int j=0;j<n;j++){
			if(i&1<<j) p*=1.0/100*b[j];
			else p*=1.0/100*(100-b[j]);
		}
		res+=p*(dp[1][i]-dp[0][i]);
	}
	cout<<syosu(9)<<res<<endl;
}


Measured memory_bytes: 35788
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long 
#define mod 1000000007;
using namespace std;
int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    cout<<n*n*n;

    return 0;
}

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

using tap = std::tuple<unsigned long, unsigned long, unsigned long>; // (val, 10^n, 111...)
constexpr unsigned long MOD = 998244353;

tap op(tap a, tap b){
    const auto& [av, at, ar] = a;
    const auto& [bv, bt, br] = b;
    return {(av * bt + bv) % MOD, at * bt % MOD, (ar * bt + br) % MOD};
}

tap e(){
    return {0, 10, 1};
}

tap mapping(unsigned long v, tap x){
    if(v == 0)return x;
    const auto& [xv, xt, xr] = x;
    return {xr * v % MOD, xt, xr};
}

unsigned long composition(unsigned long f, unsigned long g){
    if(f == 0)return g;
    return f;
}

unsigned long id(){
    return 0;
}

int main(){
    using namespace std;
    using namespace atcoder;
    unsigned long N;
    cin >> N;
    lazy_segtree<tap, op, e, unsigned long, mapping, composition, id> sgt(vector<tap>(N, {1, 10, 1}));
    unsigned long Q;
    cin >> Q;
    for(unsigned long i{0}, L, R, D; i < Q; ++i){
        cin >> L >> R >> D;
        sgt.apply(L - 1, R, D);
        cout << get<0>(sgt.prod(0, N)) * 299473306 % MOD << endl;
    }
    return 0;
}


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

int main()
{
    int S,h,m,s;
    cin>>S;
    h=S/3600;
    m=(S-(h*3600))/60;
    s=S-(h*3600)-(m*60);

    cout<<h<<":"<<m<<":"<<s<<endl;
    return 0;
}






Measured memory_bytes: 3104
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll M = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1)) % M;
}

//素数判定
bool prime(ll num){
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; 
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2){
		if (num % i == 0) return false;
	}
	return true;
}

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

	map<ll, ll> p;
	for (ll n = 1; n <= N; n++) {
		for (ll d = 1; d <= n; d++) {
			if (prime(d) && n%d == 0) {
				ll tmp = n;
				while (1) {
					p[d]++;
					tmp /= d;
					if (tmp %d != 0)break;
				}
			}
		}
	}

	ll ans = 1;
	auto begin = p.begin(), end = p.end();
	for (auto it = begin; it != end; it++) {
		ans *= (it->second + 1);
		ans %= M;
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
use std::io::stdin;

macro_rules! read {
    ($t: ty) => {{
        let mut line = String::new();
        stdin().read_line(&mut line);
        line.trim().parse::<$t>().unwrap()
    }};
    ($($t: ty), *) => {{
        let mut line = String::new();
        stdin().read_line(&mut line);
        let mut iter = line.split_whitespace();
        (
            $(iter.next().unwrap().parse::<$t>().unwrap(), )*
        )
    }}
}
macro_rules! reads {
    ($t:ty) => {{
        let mut v = vec![];
        let mut line = String::new();
        stdin().read_line(&mut line);
        let mut iter = line.split_whitespace();
        while let Some(n) = iter.next() {
            v.push(n.parse::<$t>().unwrap());
        }
        v
    }};
    ($e:expr, $t:ty) => {{
        let mut v = vec![];
        for _ in 0..$e {
            let mut line = String::new();
            stdin().read_line(&mut line);
            v.push(line.trim().parse::<$t>().unwrap());
        }
        v
    }};
}

fn is_yymm(yy: usize, mm: usize) -> bool {
    mm < 13 && mm > 0
}

fn is_mmyy(mm: usize, yy: usize) -> bool {
    mm < 13 && mm > 0
}

fn main() {
    let s = read!(String);
    
    let f1 = s[0..2].parse::<usize>().unwrap();
    let f2 = s[2..4].parse::<usize>().unwrap();

    let b1 = is_yymm(f1, f2);
    let b2 = is_mmyy(f1, f2);

    if b1 && b2 {
        println!("AMBIGUOUS");
    } else if b1 {
        println!("YYMM");
    } else if b2 {
        println!("MMYY");
    } else {
        println!("NA");
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#include<vector>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#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 ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define CEVCOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define M map<int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void){

    int N, K;	cin >> N >> K;
    ll ans = 0;

    ans += (ll)pow(N / K , 3);
  
    if(K % 2 == 0)
      ans += (ll)pow((N + K / 2) / K , 3);
    
    SCOUT(ans) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<int, int>;
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

int n, u, v;
vector< vector<int> > graphlist(100100, vector<int>());
vector<int> takahashi(100100, -1);
vector<int> aoki(100100, -1);
struct posdata {
    int p; int dist;
};

int main() {
    cin >> n >> u >> v;
    u--; v--;
    takahashi.at(u) = 0; aoki.at(v) = 0;
    for(int i = 0; i < n-1; ++i) {
        int aa, bb; cin >> aa >> bb;
        aa--; bb--;
        graphlist.at(aa).emplace_back(bb);
        graphlist.at(bb).emplace_back(aa);
    }

    queue<posdata> tque;
    posdata tfirst;
    tfirst.p = u; tfirst.dist = 0;
    tque.push(tfirst);
    while(!tque.empty()) {
        posdata now = tque.front();
        tque.pop();
        for(int i = 0; i < (int)graphlist.at(now.p).size(); ++i) {
            int np = graphlist.at(now.p).at(i);
            int ndist = now.dist+1;
            if(takahashi.at(np) == -1) {
                takahashi.at(np) = ndist;
                posdata next;
                next.p = np; next.dist = ndist;
                tque.push(next);
            }
        }
    }

    queue<posdata> aque;
    posdata afirst;
    afirst.p = v; afirst.dist = 0;
    aque.push(afirst);
    while(!aque.empty()) {
        posdata now = aque.front();
        aque.pop();
        for(int i = 0; i < (int)graphlist.at(now.p).size(); ++i) {
            int np = graphlist.at(now.p).at(i);
            int ndist = now.dist+1;
            if(aoki.at(np) == -1) {
                aoki.at(np) = ndist;
                posdata next;
                next.p = np; next.dist = ndist;
                aque.push(next);
            }
        }
    }

    int amax = 0;
    for(int i = 0; i < n; ++i) {
        if(aoki.at(i) > takahashi.at(i)) {
            chmax(amax, aoki.at(i));
        }
    }

    cout << amax-1 << endl;
}

Measured memory_bytes: 6784
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;

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

  for (ll i = 1; i <= 3500; i++) {
    for (ll j = 1; j <= 3500; j++) {
      ll u = 4 * i * j - n * (i + j);
      ll d = n * i * j;
      if (u <= 0 || u > d) continue;
      if (d % u == 0) {
        ll k = d / u;
        printf("%ld %ld %ld\n", i, j, k);
        return 0;
      }
    }
  }
}


Measured memory_bytes: 3800
/*
    Problem 85
    https://onlinejudge.u-aizu.ac.jp/problems/DSL_1_A
*/
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* class */
class DisjointSet {
    public:
    vector<int> d;
    DisjointSet(int size) : d(size, -1) {}
    int find(int x) {
        if (d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x, int y) {
        x = find(x), y = find(y);
        if (x == y) return false;
        if (x > y) swap(x, y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x, int y) { return find(x) == find(y); }
};
/* constant */
/* global variables */
/* function */
/* main */
int main(){
    int n, q, com, x, y;
    cin >> n >> q;
    DisjointSet ds =  DisjointSet(n);
    for (int i = 0; i < q; i++) {
        cin >> com >> x >> y;
        if (com == 0) ds.unite(x, y);
        else cout << (ds.same(x, y) ? 1 : 0)<< '\n';
    }
}



Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 100005;
const ll mod = 1000000007;
ll rtmp[MAXN];
ll r[MAXN];

int main()
{
    string s;
    int d;
    cin >> s >> d;

    int prsum = 0;
    for (int i = 0; i < s.size(); i++)
    {
        for (int j = 0; j < d; j++)
        {
            rtmp[j] = 0;
            for (int dg = 0; dg <= 9; dg++)
                rtmp[j] += r[(j - (dg%d) + d) % d];
            rtmp[j] %= mod;
        }
        int digit = (int)(s[i] - '0');
        for (int dg = 0; dg < digit; dg++)
        {
            rtmp[(prsum + dg)%d]++;
            rtmp[(prsum + dg)%d] %= mod;
        }
        prsum += digit;
        swap(rtmp, r);
    }
    r[prsum%d]++;
    cout << (r[0] - 1 + mod) % mod;
    return 0;
}




Measured memory_bytes: 1792
#include<stdio.h>
#define MAX 2000

int solve(int, int);

int n, A[MAX];

main()
{
  int q, mi[MAX], i;

  scanf("%d", &n);
  for(i=0; i<n; i++)
    {
      scanf("%d", &A[i]);
    }

  scanf("%d", &q);
  for(i=0; i<q; i++)
    {
      scanf("%d", &mi[i]);

      if(solve(0, mi[i]))printf("yes\n");
      else printf("no\n");
    }

  return 0;
}

int solve(int i, int m)
{
  if(A[i] == m)return 1;
  if(i+1 == n)return 0;
  if(solve(i+1, m-A[i]) || solve(i+1, m))return 1;
  return 0;
} 

Measured memory_bytes: 588
#include <bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;

int main(){
    double L;
    cin >> L;
    double l;
    l=L/3;
    cout << fixed << setprecision(12);
    cout << l*l*l << endl;
    return 0;
}

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

int main()
{
	int x,ii;
	int y = 0,result = 0, ans = 0;
	cin >> x;

	for(int i = 2; i <= x; i++)
	{
		if(i%2==0)
		{
			ii = i;
			while(ii%2==0)
  			{
				y += 1;
				ii /= 2;
			}
		}
		if (result < y)
		{
			result = y;
			ans = i;
		}
		y = 0;
	}
	if (x == 1){
		cout << 1 << endl;
	}else{
		cout << ans << endl;
	}
}


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

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

     for(int i = 0; i < n.size(); i++){ 
          if(n.at(i) == '1') n.at(i) = '9';
          else if(n.at(i) == '9') n.at(i) = '1';
     }

cout << n << endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
typedef vector<vector<int>> Graph;
const int inf = 1e9;
const int mod = 1e9 + 7;

class SCC {
private:
    const int n;
    VV G;
    VV rG;
    V vs;
    vector<bool> used;
    V cmp;
public:
    SCC(int _n) : n(_n), G(_n), rG(_n), used(_n), cmp(_n) {}
    void addEdge(int from, int to) {
        G[from].emplace_back(to);
        rG[to].emplace_back(from);
    }
    void dfs(int v) {
        used[v] = true;
        for (auto&& nxt : G[v]) {
            if (!used[nxt]) dfs(nxt);
        }
        vs.emplace_back(v);
    }
    void rdfs(int v, int k) {
        used[v] = true;
        cmp[v] = k;
        for (auto&& nxt : rG[v]) {
            if (!used[nxt]) rdfs(nxt, k);
        }
        vs.emplace_back(v);
    }
    int scc() {
        rep(v, n) {
            if (!used[v]) dfs(v);
        }
        // reverse(all(vs));
        used.assign(n, false);
        int k = 0;
        // for (auto&& v : vs) {
        for (int i = vs.size() - 1; i >= 0; i--) {
            int v = vs[i];
            if (!used[v]) rdfs(v, k++);
        }
        return k;
    }
    bool same(int a, int b) {
        return cmp[a] == cmp[b];
    }
};


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

    int N, M;
    cin >> N >> M;
    SCC scc(N);
    rep(i, M) {
        int s, t;
        cin >> s >> t;
        scc.addEdge(s, t);
    }

    scc.scc();

    int Q;
    cin >> Q;
    rep(i, Q) {
        int u, v;
        cin >> u >> v;
        cout << scc.same(u, v) << endl;
    }

}

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

int main() {

    int A, B;
    // string S, T, U;
    // cin >> S >> B;
    cin >> A >> B;
    if (A==B){
        cout << "Yes" << endl;
        // cout << A-1 << " " << B << endl;
    }else{
        cout << "No" << endl;
        // cout << A << " " << B-1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<(int)N;i++)
const int INF=1<<30;
int main()
{
  int H,W;
  cin>>H>>W;
  vector<vector<char>> data(H,vector<char>(W,'-'));
  vector<vector<int>> move(H,vector<int>(W));
  rep(i,H)rep(j,W) cin>>data.at(i).at(j);
  move.at(0).at(0)+=(data.at(0).at(0)=='#');
  rep(i,H)rep(j,W)
  {
    if(i>0||j>0)
    {
      move.at(i).at(j)
        =min(
          (i>0)?move.at(i-1).at(j)+(data.at(i).at(j)=='#'&&data.at(i-1).at(j)=='.'):INF,
          (j>0)?move.at(i).at(j-1)+(data.at(i).at(j)=='#'&&data.at(i).at(j-1)=='.'):INF
      	);
    }
  }
  cout<<move.at(H-1).at(W-1)<<endl;
}

Measured memory_bytes: 256
// B - Collecting Balls (Easy Version)
#include <bits/stdc++.h>
using namespace std;

int N, K;
int X[100];

int main() {
  int length = 0;
  // ここにプログラムを追記
  cin >> N >> K;
  for(int i = 0; i<N; i++){
    cin >> X[i];
     length += min(abs(X[i] - K), abs(X[i]));
  }

  cout << length*2 << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int A,B;

  scanf("%d %d",&A,&B);

  if(2*A-1<A+B){
    if(A+B<2*B-1){
      printf("%d\n",2*B-1);
    }
    else{
      printf("%d\n",A+B);
    }
  }

  else{
    if(2*A-1<2*B-1){
      printf("%d\n",2*B-1);
    }
    else{
      printf("%d\n",2*A-1);
    }
  }

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <math.h>
#include <vector>
#include <memory>
#include <time.h>
#include <thread>
#include <chrono>

using namespace std;

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

	int d1 = n / 100;
	int d3 = n % 10;

	if (d1 == d3)
		cout << "Yes";
	else
		cout << "No";

	return 0;
}

Measured memory_bytes: 256
n = int(input())
L = list(map(int, input().split()))
L.sort()
#print(L)
import bisect
ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        k = bisect.bisect_left(L, L[i]+L[j])
        #print(i, j, k)
        ans += max(0, k-j-1)
print(ans)


Measured memory_bytes: 74492
#include <bits/stdc++.h>
    using namespace std;
    #define ll long long
   // #define ll unsigned long long
    #define pb push_back
    #define mp make_pair
    #define fi first
    #define se second
    #define be begin()
    #define en end()
    #define le length()
    #define all(x) (x).begin(), (x).end()
    #define rep(i, n) for (ll i = 0; i < n; i++)
    #define repo(i, n) for (ll i = 1; i <= n; i++)
    #define fastIO                        \
        ios_base::sync_with_stdio(false); \
        cin.tie(NULL);                    \
        cout.tie(NULL)
    #define eps 1e-6
    #define pi 3.141592653589793
    #define c(a) cout << a << "\n";
    #define ao(a)        \
        for (auto i : a) \
            cout << i << " ";
    #define endl '\n'        
    typedef vector<int> vii;
    typedef vector<ll> vll;
    typedef pair<int, int> pii;
    typedef pair<ll, ll> pll;
    const int MOD = 1e9 + 7;
    const int INF = 1e9;
    const int N = 1e6 + 6;
 
    ll powmod(ll a, ll b, ll mod)
    {
        ll res = 1;
        a %= mod;
        for (; b; b >>= 1)
        {
            if (b & 1)
                res = (res * a) % mod;
            a = (a * a) % mod;
        }
        return res;
    }
 
    ll gcd(ll a, ll b)
    {
        while (b > 0)
        {
            ll t = a % b;
            a = b, b = t;
        }
        return a;
    }
 
    ll lcm(ll a, ll b)
    {
        return (a / gcd(a, b)) * b;
    }
 
    ll is_prime(ll n)
    {
        if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
            return 0;
        for (ll i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
            if (n % i == 0)
                return 0;
        return 1;
    }
    // long long bit[1000005], a[1000005];
    // ll N1 = 200005;
 
    // void update(int x, int del)
    // {
    //     for (; x <= N1; x += x & -x)
    //     {
    //         bit[x] += del;
    //     }
    // }
 
    // int query(int x)
    // {
    //     int sum = 0;
    //     for (; x > 0; x -= x & -x)
    //     {
    //         sum += bit[x];
    //     }
    //     return sum;
    // }
    /*************************************************************************************************************/
    int main(){
    ll k,x;
    cin>>k>>x;
    if(k*500>=x) c("Yes")
    else c("No")
    return 0;   
    }
        
 
 
 

Measured memory_bytes: 256
N = gets.to_i
A = gets.split.map(&:to_i)

sum = Array.new(N + 1, 0)
ans = []

N.downto(1) do |n|
  s = 0
  t = n

  while t <= N
    s += sum[t]
    t += n
  end

  if s % 2 != A[n - 1]
    ans << n
    sum[n] += 1
  end
end

if ans.empty?
  puts 0
else
  puts ans.size
  puts ans.sort.join(' ')
end


Measured memory_bytes: 23116
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

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

  
  if(n[0]!=n[1]&&n[1]!=n[2]&&n[0]!=n[2]){
    cout << "Yes" << endl;
  }else{
    
      cout << "No" << endl;
  }
  
  
   
  return 0;
}

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

int main(){
	int n;
	cin >> n;
  	vector<int> ans(n);
	
  	rep(i, n-1){
    	int a;
      	cin >> a;
      	ans[a-1]++;
    }
  
  	for(int x : ans){
    	cout << x << endl;
    }
}

Measured memory_bytes: 4032
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 107;
signed main() {
    cout.precision(20);
    double W, H, x, y;
    cin >> W >> H >> x >> y;
    double sq = (W * H) / 2.0;
    cout << fixed << sq << " ";
    if (2 * x == W & 2 * y == H) cout << 1 << ' ';
    else cout << 0 << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1LL << 61);
const int inf = 1001001001;
const int mod = 1000000007;

struct mint {
	ll x;
	mint(ll x = 0) :x(x% mod) {}
	mint& operator+=(const mint a) {
		(x += a.x) %= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		(x += mod - a.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 dp[105][5][5][5];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	dp[0][0][0][0] = 1;
	rep(i, n)rep(j, 5)rep(k, 5)rep(l, 5)rrep(p, 5) {
		if (k == 1 && l == 2 && p == 3) continue;
		if (k == 2 && l == 1 && p == 3) continue;
		if (k == 1 && l == 3 && p == 2) continue;
		if (j == 1 && l == 2 && p == 3) continue;
		if (j == 1 && k == 2 && p == 3) continue;
		dp[i + 1][k][l][p] += dp[i][j][k][l];
	}
	mint ans = 0;
	rep(i, 5)rep(j, 5)rrep(k, 5) {
		ans += dp[n][i][j][k];
	}
	cout << ans.x << endl;
	return 0;
}

Measured memory_bytes: 384
// Problem : D - Gathering Children
// Contest : AtCoder - AtCoder Beginner Contest 136
// URL : https://atcoder.jp/contests/abc136/tasks/abc136_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	// && has higher precedence than ||
	ios_base::sync_with_stdio(0); cin.tie(0);    
	string str;
	cin>>str;
	int N=sz(str),st=0;
	vi ans(N);
	F0R(x,N-1)
	{
		if(str[x]=='R' && str[x+1]=='L')
		{
			FORd(y,x+1,st)
			{
				if((x-y)%2==0)
				{
					ans[x]++;
				}
				else
				{
					ans[x+1]++;
				}
			}
			FOR(y,x+1,N)
			{
				if(str[y]=='R')
				{
					x=y-1;
					st=y;
					break;
				}
				if((y-x-1)%2==0)
				{
					ans[x+1]++;
				}
				else
					ans[x]++;
			}
		}
	}
	F0R(x,N)
		cout<<ans[x]<<' ';
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 4100
N=int(input())
K=int(input())

string = str(N)
digits = len(string)

#dp[i][j][k]=と同じ桁数の整数で上からi桁目までで0でない数字がj個あるものの個数
#k=0: i桁目まで見てN未満が確定, k=1: 未確定
dp = [[[0]*2 for _ in range(K+1)] for __ in range(digits+1)]
#初期状態
dp[0][0][1] = 1

for i in range(digits):
    d = int(string[i])
    ni = i+1
    for j in range(K+1):
        for k in range(2):
            for nd in range(10):
                nk = 1 if k == 1 and nd == d else 0
                if k == 1 and nd > d: break

                nj = j + (1 if nd != 0 else 0)
                if nj > K: continue

                dp[ni][nj][nk] += dp[i][j][k]

print(dp[digits][K][0] + dp[digits][K][1])


Measured memory_bytes: 41200
#include <stdio.h>
 
int main(void){
  int i,j,n,taro_p=0,hana_p=0;
  char taro[101], hana[101];
 
  scanf("%d", &n);
 
  for(i=0;i<n;i++){
    scanf("%s %s", taro, hana);
 
    for(j=0;;j++){
      if(taro[j] > hana[j]){
        taro_p += 3;
        break;
      }else if(taro[j] < hana[j]){
        hana_p += 3;
        break;
      }else if(taro[j] + hana[j] == 0){
        hana_p++;
        taro_p++;
        break;
      }
    }
  }
 
  printf("%d %d\n", taro_p , hana_p);
  return 0;
}


Measured memory_bytes: 2048
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int[] nums = new int[n];

        for (int i=0; i<n; ++i) {
            nums[i] = sc.nextInt();
        }
        for (int i=n-1; i>0; --i) {
            System.out.print(nums[i] + " ");
        }
        System.out.println(nums[0]);
        sc.close();
    }
}


Measured memory_bytes: 26208
import itertools
N = int(input())
points = []

for i in range(N):
  points.append(list(map(int,input().split())))

def calcDistance(point1,point2):
  dis = ((point1[0]-point2[0])**2 + (point1[1]-point2[1])**2)**(1/2)
  return dis
  
ans = 0
Nlist= list(itertools.permutations(range(N)))
for i in range(len(Nlist)):
  for j in range(N):
    if j != N-1:
      ans += calcDistance(points[Nlist[i][j]],points[Nlist[i][j+1]])
        
print(ans / len(Nlist))

Measured memory_bytes: 45424