akhauriyash/Code-Regression huggingface dataset:
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

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

fn main() {
    let v: Vec<usize> = read_vec();
    let (n, wmax) = (v[0], v[1]);

    let mut w = vec![0usize; n];
    let mut v = vec![0u64; n];
    for i in 0..n {
        let temp = read_vec::<u64>();
        w[i] = temp[0] as usize;
        v[i] = temp[1];
    }

    let mut dp = vec![vec![0u64; wmax + 1]; n + 1];
    for i in 0..n {
        let i: usize = n - 1 - i;
        for j in 0..wmax + 1 {
            if j < w[i] {
                dp[i][j] = dp[i + 1][j];
            } else {
                dp[i][j] = std::cmp::max(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i]);
            }
        }
    }
    println!("{:?}", dp[0][wmax]);
}


Measured memory_bytes: 106748
N=int(input())
H=list(map(int,input().split()))
F=[0]*N
if N==1:
  print(0)
else:
  i=0
  while i<=N-2:
    f=0
    j=i
    while j<=N-2:
      if H[j]>=H[j+1]:
        f=f+1
        j=j+1
      else:
        break
    F[i]=f
    i=j+1
  print(max(F))

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

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

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

    int ans = 500000000;
    for (int i=0; i<N; i++) {
        if (i+K-1 >= N) {
            break;
        }

        int ans_temp_right = 0;
        ans_temp_right += abs(x[i]);
        ans_temp_right += abs(x[i+K-1] - x[i]);

        if (ans_temp_right < ans){
            ans = ans_temp_right;
        }
    }

    for (int i=N-1; i>=0; i--) {
        if (i-K+1 < 0) {
            break;
        }

        int ans_temp_left = 0;
        ans_temp_left += abs(x[i]);
        ans_temp_left += abs(x[i-K+1] - x[i]);

        if (ans_temp_left < ans){
            ans = ans_temp_left;
        }
    }

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

Measured memory_bytes: 640
import numpy as np

a, b, h, m = map(int, input().split())

h_ = (h+m/60) * 30
m_ = m * 6
kakudo = abs(h_-m_)
kakudo = min(360-kakudo, kakudo)

ans = (a**2 + b**2 - 2*a*b*np.cos(kakudo*np.pi/180))**0.5
print(ans)

Measured memory_bytes: 27196
/*
AuThOr Gwj
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define debug_pair(A) cerr<<A.FIR<<" "<<A.SEC<<endl;
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
LL N;
map<LL,int> cnt;
vector<LL> dive;
int main(){
	cin>>N;
	if(N==1){
		cout<<0;
		return 0;
	}
	for(LL i=2;i*i<=N;i++){
		if(N%i==0){
			dive.PB(i);
			dive.PB(N/i);
		} 
	}
	if(dive.empty()){
		cout<<1<<endl;
	}
	else{
		sort(ALL(dive));
		for(auto it:dive){
			while(N%it==0){
				N/=it;
				cnt[it]++;
			}
		}
		int res=0;
		for(map<LL,int> :: IT ite=cnt.begin();ite!=cnt.end();ite++){
			int tmp=ite->SEC,now=1;
			while(tmp>=now){
				tmp-=now;
				now++;
				res++;
			}
		}
		cout<<res<<endl;
	}
	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)


int main(){
    ll N,rs=0,rs2=0;
    cin >> N;
    vector<ll> A(N);
    bool zouka=false,gensyou= false;

    for(ll i = 0;i < N;i++)
        cin >> A.at(i);

    for(ll i = 0;i < N;i++){
        if(i == N -1)
            rs++;
        else if(A.at(i) > A.at(i+1) and zouka == false and gensyou == false){
            gensyou = true;
        }else if(A.at(i) < A.at(i+1) and zouka == false and gensyou == false){
            zouka = true;
        }else if(A.at(i) < A.at(i+1) and gensyou == true){
            rs++;
            gensyou = false;
        }else if(A.at(i) > A.at(i+1) and zouka == true){
            rs++;
            zouka = false;
        }
    }

    for(ll i = 0;i < N;i++){
        if(i == N -1)
            rs2++;
        else if(A.at(i) > A.at(i+1) and zouka == false and gensyou == false){
            gensyou = true;
        }else if(A.at(i) <= A.at(i+1) and zouka == false and gensyou == false){
            zouka = true;
        }else if(A.at(i) < A.at(i+1) and gensyou == true){
            rs2++;
            gensyou = false;
        }else if(A.at(i) > A.at(i+1) and zouka == true){
            rs2++;
            zouka = false;
        }
    }

    if(rs > rs2)
        cout << rs2 << endl;
    else
        cout << rs << endl;
}

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

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

	int n;
	cin>>n;
	double dp[n][n+5];
	memset(dp,0,sizeof(dp));
	vector<double> arr(n);
	for(int i=0; i<n; ++i){
		cin>>arr[i];
	}
	dp[0][0] = (1-arr[0]); // Get 0 head
	dp[0][1] = arr[0]; // Get 1 head
	for(int i=1; i<n; ++i){
		for(int j=0; j<=i; ++j){
			dp[i][j] = dp[i-1][j] * (1-arr[i]) + dp[i-1][j-1] * arr[i];
		}
		dp[i][i+1] = dp[i-1][i] * arr[i];
	}
	double ans = 0;
	for(int i=(n-1)/2+1; i<=n; ++i){
		ans += dp[n-1][i];
	}
	cout.precision(10);
	cout<<fixed<<ans<<endl;
	return 0;
}


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

int main(){
  string S;cin>>S;
  priority_queue<int> ans;
  int count=0;
  int N=S.size();
  for(int i=0;i<N;i++){
    if(S.at(i)=='A' || S.at(i)=='G' || S.at(i)=='C' || S.at(i)=='T') count++;
    else{
      ans.push(count);
      count=0;
    }
  }
  ans.push(count);
  cout<<ans.top()<<endl;
}


Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.ABC_104
{
    class A
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int r = int.Parse(Console.ReadLine());

            if (r < 1200)
            {
                Console.WriteLine("ABC");
            }
            else if (r < 2800)
            {
                Console.WriteLine("ARC");
            }
            else
            {
                Console.WriteLine("AGC");
            }
        }
    }
}


Measured memory_bytes: 11092
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

alias Tuple!(int, "a", int, "b") Score;
const int INF = 1 << 29;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1];
    auto K = s[2];
    auto R = readln.split.map!(x => x.to!int-1).array;
    auto edges = new Tuple!(int, int)[][](N);
    foreach (_; 0..M) {
        s = readln.split.map!(to!int);
        edges[s[0] - 1] ~= tuple(s[1] - 1, s[2]);
        edges[s[1] - 1] ~= tuple(s[0] - 1, s[2]);
    }

    auto d = new int[][](N, N);
    foreach (i; 0..N)
        foreach (j; 0..N)
            d[i][j] = i == j ? 0 : INF;

    foreach (i; 0..N)
        foreach (j; edges[i]) {
            d[i][j[0]] = j[1];
        }

    for (int i = 0; i < N; i++)      // 経由する頂点
        for (int j = 0; j < N; j++)    // 開始頂点
            for (int k = 0; k < N; k++)  // 終端
                d[j][k] = min(d[j][k], d[j][i] + d[i][k]);


    int ans = 1 << 29;
    R.sort();
    do {
        int tmp = 0;
        foreach (i; 0..K-1)
            tmp += d[R[i]][R[i+1]];
        ans = min(ans, tmp);
    } while (nextPermutation(R));

    ans.writeln;
}


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

ll MOD = 1e9+7;



int main(){
    string S; cin >> S;
    ll ans = 0;
    ll cnt = 0;
    bool flag = false;
    for(int i = 0; i < S.size(); i++){
        if(S[i] == 'W') {
            if(flag)ans += i-cnt;
            cnt++;
        }

        else if(!flag && S[i] == 'B') flag = true;
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <functional>
#define int long long 
#define pi pair<int,int> 
#define endl "\n"
using namespace std ;

const int inf = 1e15 ;
const int size = 1e5 + 5 ;



int32_t main() 
{


     /*#ifndef ONLINE_JUDGE 
     freopen("input.txt","r",stdin);
     freopen("output.txt","w",stdout);
     #endif */
     int n ;
     cin >> n ;
     int dp[size] ;
     vector<int>a(n+1);
     for(int i = 1  ; i <= n ; i++ )cin >> a[i] ;
     dp[1] = 0 ;dp[2] = abs(a[2]-a[1]);
     for(int i = 3 ; i <= n ; i++ )
     {
         int h1 = a[i]-a[i-1] ; if(h1 < 0) h1 = -h1 ;
         int h2 = a[i] - a[i-2] ; if(h2 < 0 ) h2 = -h2 ;
         dp[i] = min(h1+dp[i-1],h2+dp[i-2]);
     }
     cout<<dp[n]<<endl;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

ll oddsolve(ll a) { return (a + 1) / 2 % 2; }
ll solve(ll a) {
    if (a % 2 == 1)
        return oddsolve(a);
    else
        return oddsolve(a + 1) ^ (a + 1);
}

int main() {
    ll X, Y;
    cin >> X >> Y;
    cout << (solve(Y) ^ solve(X - 1)) << endl;
}

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

int sum[1001][1001] ; 
int dp[1001][1001] ;
#define inf (1LL<<60)

void sum1(int arr[], int n)
{
	for(int i=0 ; i< n ; i++)
	{
		for(int j=i ; j< n ;j++)
		{
			sum[i][j]= arr[j]+((j==i)?0 :sum[i][j-1]) ; 
		}
	}
	
}



int fn(int arr[] ,int i ,int j,   int n )
{
	if(i>=j)
	{
		return 0 ; 
	}

	if(dp[i][j] !=-1)
	{
		return dp[i][j] ; 
	}


	int ans= inf; 
	for(int k=i ; k< j ; k++)
	{
		int z= sum[i][j]+fn(arr, i, k, n)+fn(arr, k+1, j,n) ; 
		ans=min(ans, z) ; 
	}

	return dp[i][j]=  ans ; 


}



int32_t main()
{
	int n ; 
	cin>>n ; 
	int arr[n+1] ; 
	for(int i=0 ; i<n ; i++)
	{
		cin>>arr[i] ; 
	}

	sum1(arr, n) ; 

	// for(int i=0 ; i<n ; i++)
	// {
	// 	cout<<prefix[i]<<" "; 
	// }


	memset(dp, -1, sizeof(dp)) ; 

	cout<<fn(arr,0, n-1,n) ; 
}

Measured memory_bytes: 13708
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int w,h,n,p,ans=0,out=1,in=1;
  cin >> w >> h >> n;
  for(int i=0; i<n; i++) {
    cin >> p;
    if(p) {
      in++;
    }
    else {
      out++;
    }
    if(out==w||out==w+h-1) {
      continue;
    }
    if(out<w) {
      if(out==in) {
        ans++;
      }
    }
    else if(out<w+h-1) {
      if(out-2==in) {
        ans++;
      }
    }
    else {
      if(out-4==in) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3216
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  rep(i, h) cin >> s[i];
  int ans = 0;

  rep(i, 1 << h) rep(j, 1 << w) {
    int cnt = 0;
    rep(x, h) rep(y, w) {
      if (1<<x&i) continue;
      if (1<<y&j) continue;
      if (s[x][y] == '#') cnt++;
    }
    if (cnt == k) ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <cmath>
#include <iostream>

using namespace std;
#define MAX 500000;
#define SENTINEL 2000000000;
int count=0;

void merge(int A[], int left, int mid, int right){
    int n1=mid-left;
    int n2=right-mid;
    int L[500000/2+2],R[500000/2+2];
    for(int i=0;i<n1;i++) L[i]=A[left+i];
    for(int i=0;i<n2;i++) R[i]=A[mid+i];
    L[n1]=SENTINEL;
    R[n2]=SENTINEL;
    int i=0,j=0;
    for(int k=left;k<right;k++){
        count++;
        if(L[i]<=R[j]){
            A[k]=L[i++];
        }else{
            A[k]=R[j++];
        }
    }

};

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);
    }
}

int main()
{
    int n,i;
    scanf("%d",&n);
    int A[500001];
    for(int i=0;i<n;i++)scanf("%d",&A[i]);
    mergeSort(A,0,n);
    for(i=0;i<n;i++){
        if(i)cout<<" ";
        cout<<A[i];
    }
    cout<<endl;
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 7008
object Main extends App {
  val sc = new java.util.Scanner(System.in);
  val x, y, a, b, c = sc.nextInt();
  val ps = Array.fill(a)(-sc.nextInt());
  val qs = Array.fill(b)(-sc.nextInt());
  val rs = Array.fill(c)(-sc.nextInt());

  val answer = -(
    ps.sorted.take(x) ++
    qs.sorted.take(y) ++
    rs.sorted).sorted.take(x + y).map(_.toLong).sum;

  println(answer);
}

Measured memory_bytes: 66336
import java.util.Scanner;

public class Main {
    //Tap Dance
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (sln(s)) {
            System.out.println("Yes");
        } else System.out.println("No");
        sc.close();
    }

    private static boolean sln(String s) {
        int n = s.length();
        String odd = "LUD";
        String even = "RUD";
        for (int i = 0; i < n; i++) {
            if (i % 2 == 0 && !even.contains(String.valueOf(s.charAt(i)))) return false;
            if (i % 2 == 1 && !odd.contains(String.valueOf(s.charAt(i)))) return false;
        }
        return true;
    }
}


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

int H,W;
class Puzzle{
 public:
  
  int S;
  char t[20][20];

  bool operator < (const Puzzle &p)const{
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
	if(t[i][j]==p.t[i][j])continue;
	return t[i][j]<p.t[i][j];
      }
    }
    return S<p.S;
  }
};

Puzzle p;
map<Puzzle,bool> vd;


char u[40][20][20];

int  h[40],w[40];
int n,m,a,b;
int v;
 
bool ans[2048];
 
void input();
void init();
void rotate(int,int);
 
void dfs(int,int);

void check();
bool on_check(int,int,int);
 
void on_tab(int,int,int);
void off_tab(int,int,int);
 
 
int main(){
  int S;
  while(cin>>H>>W){
    if(H==0&&W==0)break;

    input();
    init();
 
    p.S=0;
    dfs(0,0);

    cin>>m;
    for(int i=0;i<m;i++){
      cin>>a;
      S=0;
      for(int j=0;j<a;j++){
	cin>>v;
	v--;
	S+=(1<<v);
      }
      
      if(ans[S])cout<<"YES"<<endl;
      else cout<<"NO"<<endl;
    }
     
  }
  return 0;
}
 
 
void dfs(int y,int x){
    
  int tmp=p.S;
  
  bool flg=true;

  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(p.t[i][j]!='#')flg=false;
    }
  }
  if(flg){
    ans[p.S]=true;
    return;
  }

  vd[p]=true; 

  for(int i=0;i<n;i++){
    if((p.S>>i)&1==1)continue;
    for(int j=0;j<4;j++){
      
      if(on_check(y,x,4*i+j)==false)continue;
       
      p.S+=(1<<i);
      
      on_tab(y,x,4*i+j);

      if(vd[p]==false)dfs(y,x);

      off_tab(y,x,4*i+j);

      p.S=tmp;
    }
  }

  if(p.t[y][x]=='#')dfs((x+1==W?y+1:y),(x+1==W?0:x+1));
  
}
 
 
 
void rotate(int a,int b){
  for(int i=0;i<h[a];i++){
    for(int j=0;j<w[a];j++){
      u[a][i][j]=u[b][j][h[a]-i-1];
    }
  }
}
 
 
void init(){
  vd.clear();
  for(int i=0;i<2048;i++)ans[i]=false;
  
}
 
 
void input(){
  for(int i=0;i<20;i++)
    for(int j=0;j<20;j++)p.t[i][j]='.';

  string str;
  for(int i=0;i<H;i++){
    cin>>str;
    for(int j=0;j<W;j++){
      p.t[i][j]=str[j];
    }
  }
  cin>>n;
  for(int k=0;k<n;k++){
    cin>>h[k*4]>>w[k*4];
    for(int i=0;i<h[k*4];i++){
      cin>>str;
      for(int j=0;j<w[k*4];j++){
	u[k*4][i][j]=str[j];
      }
    }
    for(int i=1;i<4;i++){
      h[k*4+i]=w[k*4+i-1];
      w[k*4+i]=h[k*4+i-1];
      rotate(k*4+i,k*4+i-1);
    }
  }
}
 

 
bool on_check(int y,int x,int A){
  if(y+h[A]>H||x+w[A]>W)return false;
  for(int i=y;i<y+h[A];i++){
    for(int j=x;j<x+w[A];j++){
      if(u[A][i-y][j-x]=='#'&&p.t[i][j]=='#')return false;
    }
  }
  return true;
}
 
 
void on_tab(int y,int x,int A){
  for(int i=y;i<y+h[A];i++){
    for(int j=x;j<x+w[A];j++){
      if(u[A][i-y][j-x]=='#')p.t[i][j]='#';
    }
  }
}
 
 
void off_tab(int y,int x,int A){
  for(int i=y;i<y+h[A];i++){
    for(int j=x;j<x+w[A];j++){
      if(u[A][i-y][j-x]=='#')p.t[i][j]='.';
    }
  }
}

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

int main()
{
	string X;
	cin >> X;
	int ans =666;//ansに大きな数を入れる//

	for (int i = 0; i <= X.size()-3; i++) {//Xの長さよりも３回少なくループする。iは０から始まり１ずつふえる//

		int MIN = min(ans, abs(753 - stoi(X.substr(i, 3))));
		//ansとXから抜き出したiから三番目までの数を比べ、小さいほうをint MINに代入する。//
		//初回は大きな数と比べるため必ず抜き出した数がint MINに代入される//
		ans = abs(MIN);
		//int MINを絶対値にしてansに代入し、ループする//
	}
	//上のfor文で最も小さいansを出力する//
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    x = I()

    for a in range(-118,119+1):
        for b in range(-119,118+1):
            if a**5-b**5==x:
                break
        if a**5-b**5==x:
            break
    print(a,b)
main()            


Measured memory_bytes: 10024
S = input()
if S[:2] == "00":
  if int(S[2:]) > 12 or S[2:] == "00":
  	print("NA")
  else:
    print("YYMM")
elif S[2:] == "00":
  if int(S[:2]) > 12:
  	print("NA")
  else:
    print("MMYY")
elif int(S[:2]) > 12 and int(S[2:]) > 12:
  print("NA")
elif int(S[:2]) < 13 and int(S[2:]) < 13:
  print("AMBIGUOUS")
elif int(S[:2]) < 13:
  print("MMYY")
else:
  print("YYMM")

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

int main(int argc, char const *argv[])
{
	int N;
	vector<int> ans;
	cin>>N;
	int A[N+1]={0};
	for(int i=1; i<=N;i++){
		cin>>A[i];
	}
	int parity = 0;
	int setBits = 0;
	for(int i=N; i>0; i--){
		parity = 0;
		for(int j=1;i*j<=N; j++){
			parity = (A[i*j] + parity)%2;
		}
		if(parity&1){
			setBits++;
		}
		A[i] = parity;
	}
	cout<<setBits<<"\n";
	for(int i=1; i<=N; i++){
		if(A[i] == 1){
			cout<<i<<" ";
		}
	}

	return 0;
}

Measured memory_bytes: 1792
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")

// -------------------</optimizations>--------------------
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define d long double
#define pii pair<int,int>
#define pb push_back
#define pf push_front
#define cases int tc;cin>>tc;while(tc--)
#define N 100003
#define M 103
#define inf LLONG_MAX
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//int mod=1e9+7;
//int mod=998244353;


signed main()
{
    SPEED

    int a,b;
    cin>>a>>b;
    if(a>12)
        cout<<b;
    else if(a>=6)
        cout<<b/2;
    else
        cout<<0;


    return 0;
}


Measured memory_bytes: 256
i,j,h,w;main(){
	char s[51][51];
	scanf("%d%d",&h,&w);
	for(i=0;i<h;i++)scanf("%s",s[i]);
	for(i=0;i<h;i++)for(j=0;j<w;j++)if(s[i][j]=='#')if(s[i-1][j]=='.'&&s[i][j-1]=='.'&&s[i][j+1]=='.'&&s[i+1][j]=='.'){printf("No");return 0;}
	printf("Yes");
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <set>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include <sstream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <fstream>
#include <iomanip>
//#include <unordered_map>
using namespace std;
#define dbg(x) cerr << #x " = " << x << endl;
typedef pair<int, int> P;
typedef long long ll;
const int MAXN = 55;
ll a[MAXN];
ll dp[55][55*55];
int main()
{
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n, A;
    cin >> n >> A;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    dp[0][0] = 1;
    for(int i = 1; i <= n; i++)
    {
        for(int j = i; j > 0; j--)
        {
            for(int k = A * n; k >= a[i]; k--)
            {
                dp[j][k] += dp[j - 1][k - a[i]];
            }
        }
    }
    ll ans = 0;
    for(int i = 1; i <= n; i++)
    {
        ans += dp[i][i *A];
    }
    cout << ans << endl;
    

}

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

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

int main(){
    string s;
    cin>>s;
    
    reverse(s.begin(),s.end());
    rep(i,4) reverse(divide[i].begin(), divide[i].end());
    
    bool can = true;
    for(int i=0;i<s.size();){
        bool can2 = false;
        rep(j,4){
            string d = divide[j];
            if(s.substr(i,d.size())==d){
                can2 = true;
                i += d.size();
            }
        }
        if(!can2){
            can = false;
            break;
        }
    }
    
    if(can) cout<< "YES" << endl;
    else cout << "NO" << endl;
    
    return 0;
}


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


int main() {
string s;
cin >>s;
int ans=1;
for(int i=1;i<=s.size()/2-1;++i){
    if(s.substr(0,i)==s.substr(i,i)){
        ans = max(ans,i);
    }
}
cout << ans*2 << endl;
}

Measured memory_bytes: 256
from collections import Counter

n = int(input())
arr = list(map(int, input().split()))
dct = dict(Counter(arr))
sm = sum(arr)

q = int(input())
for _ in range(1, q+1):
    b, c = map(int, input().split())
    if b in dct:
        n = dct[b]
        dct[b]=0
        if c in dct:
            dct[c]+=n
        else:
            dct[c]=n
        sm = sm + (c-b)*n
    else:
        pass

    
    print(sm)
    


Measured memory_bytes: 21604
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;


int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int h[10];
    int i,j;
    for(i=0;i<10;i++)
      scanf("%d",&h[i]);
    sort(h,h+10);
    printf("%d\n%d\n%d\n",h[9],h[8],h[7]);
    //fclose(stdin);
    //fclose(stdout);
    return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ASC(x) sort(ALL((x)))
#define DESC(x) sort(ALL((x)),greater<ll>())
#define REV(x) reverse(ALL((x)))
#define pb push_back

ll gcd(ll a, ll b)
{
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int main()
{
    ll N;
    cin >> N;
    vec A(N);
    REP(i,0,N) cin >> A[i];
    ASC(A);

    vec B;
    map<ll,ll> C;
    FORR(a,A) ++C[a];

    ll M = SZ(C), cnt = 0;
    if(M > 0) {
        vector<bool> F(A[N-1]+1, true);
        FORR(c,C) {
            if(F[c.first]) {
                for(ll b=c.first*2; b<=A[N-1]; b+=c.first) F[b] = false;
            }
        }
        FORR(c,C) if(c.second > 1) F[c.first] = false;
        FORR(c,C) {
            cnt += (F[c.first] ? 1 : 0);
            //if(F[a]) PS(a);
        }
        //PR("");
    }

    PR(cnt);
    

    return 0;
}

/*



*/

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


int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int N , M , K;
	cin >> N >> M >> K;
	int tab[N + 1];
	int tab2[M + 1];
	tab[0] = 0;
	tab2[0] = 0;
	for (int i = 0 ; i < N ; i++)
	{
		int a;
		cin >> a;
		tab[i + 1] = tab[i] + a;
	}
	for (int i = 0 ; i < M ; i++)
	{
		int a;
		cin >> a;
		tab2[i + 1] = tab2[i] + a;
	}

	int inGauche = M;
	int meilleur = 0;
	for (int i = 0 ; i <=  N ; i++)
	{
		while (inGauche >0 && tab[i]  + tab2[inGauche] > K)
		{
			inGauche--;
		}
		if (tab[i] + tab2[inGauche] <= K)
		{
			meilleur = max(meilleur , i + inGauche);
		}
	}
	cout<<meilleur<<endl;
}

Measured memory_bytes: 6736
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<int, pi> pii;
#define f first
#define s second
#define pb push_back

long long n, a, b;

int main() {
	cin >> n >> a >> b;
	cout << (n/(a+b))*a + min(a, n % (a+b));
}


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

void solveA(){
  string n;
  cin >> n;

  for(int i=0;i<3;i++){
    if(n[i]=='1'){
      n[i]='9';
    }
    else {
      n[i]='1';
    }
  }

    cout << n << endl;
}
void solveB(){
}

void solveC(){
  
}
void solveD(){

}

int main(){
  solveA();
}


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

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

    map<ll, ll> m;
    rep(i, n) {
        ll a, b;
        cin >> a >> b;
        m[a] += b;
    }

    ll acc = 0;
    for (auto c : m) {
        acc += c.second;
        if (acc >= k) {
            cout << c.first << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 4224
#include<iostream>
#include<iomanip>
using namespace std;
int main() {
	int n;
	float sum=0;
	cin>>n;
	if(n%2==1)sum=n/2+1;
	else sum=n/2;
	cout<<fixed<<setprecision(10)<<sum/n;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<cassert>
#include<algorithm>
#include<cassert>
#include<map>
#include<vector>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

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

bool vis[200][200];
bool w[200][200];
void dfs(int r,int c,int y,int x){
  if (vis[y][x])return;
  //if (y <  9 && x < 4)cout << x <<" " << y << endl;
  vis[y][x] = true;
  rep(i,6){
    int nex = x+dx[y%2][i],ney = y+dy[i];
    //if (y < 9 && x < 4)cout << x <<" " << y <<" "<< nex <<" " << ney <<" " << w[ney][nex] <<  endl;
    if (nex == -1 || ney == -1 || nex == c || ney == r || w[ney][nex])continue;
    dfs(r,c,ney,nex);
  }
}

main(){
  int r,c;
  while(cin>>c>>r){
    rep(i,200)rep(j,200)vis[i][j] = w[i][j] = false;
    REP(i,1,r+1){
      REP(j,1,c+1){
	cin>>w[i][j];
      }
    }
    dfs(200,200,0,0);
    int ans = 0;
    rep(i,200){
      rep(j,200){
	if (!w[i][j])continue;
	rep(k,6){
	  int nex = j+dx[i%2][k],ney = i+dy[k];
	  if (nex == -1 || ney == -1 || nex == 200 || ney == 200 || w[ney][nex])continue;
	  if (vis[ney][nex])ans++;
	}
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 0
//https://atcoder.jp/contests/dp/tasks/dp_f
#define AT_LCS
#ifdef AT_LCS
using namespace std;
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>

#define MOD1e9 1000000007
#define INT_MAX       2147483647
#define INT_MIN     (-2147483647 - 1)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(c) for(int i = 0; i <(c); ++i)
#define rrep(n) for(int i = (n) ; i >=0 ; --i)
#define fora(i, s, c) for(int i = (s); i < (c); ++i)
#define forr(i, s, c) for(int i = (s); i > (c); --i)
#define endl "\n"
#define ret(n) return n
#define pb push_back
#define eb emplace_back
#define ff first;
#define ss second;
#define mp make_pair;
#define all(p) p.begin(),p.end()
#define mid(s,e) (s+(e-s)/2)
//Typedefs
typedef long long ll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef priority_queue<int> pqint;
typedef priority_queue<ll> pqll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<long> vl;
typedef vector<vl> vvl;


vector<char> printlcsIter(string& s, string& t)
{
    //lcs array
    vvi lcs(s.size() + 1, vi(t.size() + 1, 0));
    for (int i = 1; i <= s.size(); ++i)
    {
        for (int j = 1; j <= t.size(); ++j)
        {
            if (s[i - 1] == t[j - 1])
            {
                lcs[i][j] = 1 + lcs[i - 1][j - 1];
            }
            else
            {
                lcs[i][j] = max(lcs[i][j - 1], lcs[i - 1][j]);
            }
        }
    }

    int lcslen = lcs[s.size()][t.size()];
    vector<char> subseq(lcslen);
    int i = s.size();
    int j = t.size();
    int lcsindex = lcslen;
    while (i > 0 && j > 0)
    {
        if (s[i - 1] == t[j - 1])
        {
            subseq[lcsindex - 1] = s[i - 1];
            --lcsindex;
            --i;
            --j;
        }
        else
        {
            if (lcs[i - 1][j] > lcs[i][j - 1])
            {
                --i;
            }
            else
            {
                --j;
            }
        }
    }
    return subseq;
}
int main()
{
    string s;
    string t;
    cin >> s >> t;
    auto ans = printlcsIter(s, t);
    if (ans.empty())
    {
        cout << "" << endl;
    }
    else
    {
        for (auto c : ans)
            cout << c;
        cout << endl;
    }
    ret(0);
}

#endif // AT_LCS


Measured memory_bytes: 35584
SIZE = 3001
def main():
    output = 0
    R, G, B, N = (int(_) for _ in input().split())
    for r in range(SIZE):
      for g in range(SIZE):
        b = N - r * R - g * G
        if 0 <= b and b%B == 0: output += 1
    print(output)
    return

if __name__ == '__main__':
    main()
    

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

/*============================ DEBUGGING =============================*/

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

/*============================= DEFINES ==============================*/

#define eps 1e-9
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define B begin()
#define E end()
#define F first
#define S second
#define tostr(x) to_string(x)
#define SZ(x) ((int)x.size())
#define ins insert
#define rep(i,x,y) for(int i=x;i<y;i++)
#define per(i,x,y) for(int i=x;i>y;i--)
#define repi(i,x,y) for(int i=x;i<=y;i++)
#define peri(i,x,y) for(int i=x;i>=y;i--)
#define inf (ll)LLONG_MAX
#define ds1(i,x) for(auto i=x.begin();i!=x.end();i++)
#define ds2(i,x) for(auto i:x)
#define fib(n) ceil(pow((1+sqrt(5),n)-pow((1-sqrt(5),n)/(float)(pow(2,n)*sqrt(5)
#define FIO {ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
#define dig(n) (int)(log10(n)+1)
#define ss(x,k) substr(x,k)  // x is the start pos and k is the length of substr.
#define set(x,k) memset(x,k,sizeof x)

/*============================== TYPEDEFS ============================*/

typedef long long ll;
typedef long double ld;
typedef long l;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vlli;
typedef vector<bool> vb;
typedef queue<int> qi;
typedef vector<pair<int,int> > vpii;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;

/*============================ START FROM HERE =======================*/

int main(){
	FIO
	
	int a,b;cin>>a>>b;
	if(a<10 && b<10)cout<<a*b;
	else cout<<-1;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void fast()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
}
int main()
{
    fast();

    int n;cin>>n;
    string s,t;cin>>s>>t;
    for(int i=0;i<n;i++)
    {
        cout<<s[i]<<t[i];
    }
    return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int a,b,c; cin >> a >> b >> c;
	int ma=max(a,max(b,c));
	if(ma==a){
		cout << "A" << endl;
	}
	else if(ma==b){
		cout << "B" << endl;
	}
	else{
		cout << "C" << endl;
	}
}



Measured memory_bytes: 3144
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include<cstdio>
#include<cstring>
#include<queue>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef pair<int,int> P;
typedef pair<double,double> P_f;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define reprev(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define bitrep(bit,n) for(int bit=0; bit<=(1<<n);bit++)
#define MAX 100100
#define MAX_N 200100
#define MAX_T 2001001
#define SENTINEL 20010010010
#define NIL -1
static const int INF = 1 << 29;
const ll INFTY = 1LL<<50;
const int MOD=1e9+7;
int n;
int a[MAX];
LL jou(int p,int s){
    int i=0;
    LL ans=1;
    while(i<s){
        ans=ans*p%MOD;
        i++;
    }
    return ans;
}

int main(){
    cin>>n;rep(i,n)cin>>a[i];
    sort(a,a+n);
    if(n%2==0){
        int m=n/2;
    rep(i,m){
        if(a[2*i]!=a[2*i+1] || a[2*i]!=2*i+1){
            cout<<0<<endl;return 0;
        }
    }
    LL ans =jou(2,m);
    cout<<ans<<endl;
    }
    else {
        int m=n/2;
        for(int i=1;i<=m;i++){
            if(a[0]!=0 ||a[2*i-1]!=a[2*i] ||a[2*i]!=2*i){
                cout<<0<<endl;return 0;
            }
        }
        LL ans=jou(2,m);
        cout<<ans<<endl;
    }
    return 0;

}

Measured memory_bytes: 640
use std::io::{stdin, Read};
use std::str::FromStr;

// https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn main() {
    let n = read::<usize>();
    let k = read::<usize>();
    let mut hh = (0..n).map(|_| read::<usize>()).collect::<Vec<_>>();
    hh.sort();

    use std::cmp::min;
    let mut ans = usize::max_value();
    for i in k - 1..n {
        ans = min(ans, hh[i] - hh[i - (k - 1)]);
    }
    println!("{}", ans)
}


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

int main() {
  int n; cin >> n;
  vector<vector<int>>to(n), cost(n);
  rep(i,n-1) {
    int a, b, w; cin >> a >> b >> w;
    a--; b--;
    to[a].push_back(b); cost[a].push_back(w);
    to[b].push_back(a); cost[b].push_back(w);
  }
  vector<int>ans(n,-1);
  queue<int> q;
  ans[0] = 0;  q.push(0);
  while(!q.empty()) {
    int v = q.front(); q.pop();
    rep(i, to[v].size()) {
      int u = to[v][i];
      int w = cost[v][i];
      if(ans[u] != -1) continue;
      ans[u] = (ans[v]+w) % 2;
      q.push(u);
    }
  }
  rep(i,n) cout << ans[i] << endl;
  return 0;
}
  


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

int main()
{
    int d, n;
    cin >> d >> n;
    if (n == 100) n++;

    int t = 1;
    for (int i = 0; i < d; i++) t *= 100;
    cout << t * n << endl;

    return 0;
}


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

int main(void) {
	int n;
	cin >> n;
	vector<int> a(n + 1);

	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	int first = a.size() / 2;
	int ans = a[first + 1] - a[first];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>

typedef struct proces{
  char eee[10];
  int rrr;
  int time;
}def;

int head,n,tail;
def o[100000];

void aaa(def s){
  o[tail]=s;
  tail=(tail+1)%100000;
}

def deq(){
  def sd=o[head];
  head=(head+1)%100000;
  return sd;
}

int min(int k,int l){
  if(k>l) return l;
  else return k;
}

int main(){
  int tasu,i,q,b,sum=0;
  def type;
  scanf("%d %d",&b,&q);
  for(i=1;i<=b;i++){
    scanf("%s",o[i].eee);
    scanf("%d",&o[i].time);
    o[i].rrr=1;
  }
  head=1;
  tail=b+1;
  while(tail != head){
    type=deq();
    tasu=min(q,type.time);
    type.time=type.time-tasu;
    sum=sum+tasu;
    if(type.time>0){
      aaa(type);
    }
    else if(type.rrr==1){
      printf("%s %d\n",type.eee,sum);
      type.rrr=0;
    }
  }
  return 0;
}





Measured memory_bytes: 3660
import sys
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False

def ddprint(x):
  if DBG:
    print(x)

s = input().strip()
if len(s)<=2:
    if len(s)==2 and s[0]==s[1]:
        print('1 2')
    else:
        print('-1 -1')
    exit()
for i in range(2,len(s)):
    if s[i]==s[i-2]:
        print('{} {}'.format(i-1,i+1))
        exit()
    if s[i]==s[i-1]:
        print('{} {}'.format(i,i+1))
        exit()
print('-1 -1')


Measured memory_bytes: 39280
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
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 Graph = vector<vector<int> >;
// MOD
const int MOD = 1000000007;

long long INF = 1<<30;
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

int H, W;
int field[100][100];

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double PI=3.14159265358979323846;
bool seen[100][100];


string N[100];

bool memo[110];
bool flag;
Graph G;

int dist[100][100];

bool compare_f(pair<int, int> &x, pair<int, int> &y) {
  return x.second< y.second;
}

int dp[100000];

struct Unionfind{
    vector<int> par;

    Unionfind(int n) : par(n, -1){}

    int root(int x){
        if(par[x] < 0) return x;
        else return par[x] = root(par[x]);
    } 

    bool issame(int x, int y){
        return root(x) == root(y);
    }

    bool merge(int x, int y){
        x = root(x); y = root(y);
        if(x == y) return false;
        if(par[x]>par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x){
        return -par[root(x)];
    }
};

int main() {
    string S; cin >> S;
    if(S == "ARC") cout << "ABC" << endl;
    else cout << "ARC" << endl;
}

Measured memory_bytes: 3164
import sys
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
x = int(readline())

res,mod = divmod(x,11)
res*=2
if mod == 0:
    print(res)
elif mod <= 6:
    print(res+1)
else:
    print(res+2)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
 
#define rep(i,n) for(int i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;

int n,m,q;
vector<int> a,b,c,d;
int ans;

void dfs(vector<int> A){
    if(A.size() == n){
        int now = 0;
        rep(i,q) {
            if(A[b[i]-1] - A[a[i]-1] == c[i]) now += d[i];
        }
        ans = max(ans,now);
        return;

    }

    A.push_back(A.back());
    while(A.back() <= m){
        dfs(A);
        A.back()++;
    }

}

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

    ll a,b,c,k;
    cin >> a >> b >> c >> k;
    ll ans = 0;
    if(a <= k){
        ans += a;
    }else{
        ans += k;
        cout << ans << endl;
        return 0;
    }
    k -= a;
    if(b >= k){
        cout << ans << endl;
        return 0;
    }else {
        k -= b;
        if(k <= c){
            ans -= k;
        }else{
            ans -= c;
        }
    }
    cout << ans << endl;

    cout << endl;
    return 0;
}


Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);

		double dbLength1 = scanner.nextDouble();
		double dbLength2 = scanner.nextDouble();
		double dbAngle = scanner.nextDouble();

		double dbRad = Math.toRadians(dbAngle);
		double dbsin = Math.sin(dbRad);
		// 面積の計算
		double dbArea = (double)(dbLength1 * dbLength2 * dbsin / 2);

		double dbcos = Math.cos(dbRad);
		// 残りの辺の計算
		double dbLength32 = Math.pow(dbLength1, 2) + Math.pow(dbLength2, 2)
								- 2 * dbLength1 * dbLength2 * dbcos;

		double dbLength3 = Math.sqrt(dbLength32);
		// 周の長さの計算
		double dbCycle = dbLength1 + dbLength2 + dbLength3;
		// 高さを求める
		double dbHeight = 2 * dbArea / dbLength1;

		System.out.println(String.format("%.8f", dbArea));

		System.out.println(String.format("%.8f",dbCycle));

		System.out.println(String.format("%.8f",dbHeight));
	}

}



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

using lint = long long;

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

  vector<lint> v(n);
  for (auto & a : v) cin >> a;
  sort(v.rbegin(), v.rend());

  vector<lint> a;
  for (int i = 0; i < n - 1; ++i) {
    if (v[i] == v[i + 1]) {
      a.push_back(v[i]);
      i++;
    }
  }

  if (a.size() < 2) cout << 0 << endl;
  else cout << a[0] * a[1] << endl;
}


Measured memory_bytes: 1660
#include<iostream>
#include<cstdlib>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<cmath>

using namespace std;
int main(){
    long n, k, q;
    cin >> n >> k >> q;
    long a[q];
    for(int i(0);i<q;i++)cin >> a[i];
    long b[n];
    for(int i(0);i<n;i++) b[i] = k-q;
    
    for(int i(0);i<q;i++){
        b[a[i] -1] += 1;
    }
    
    for(int i(0);i<n;i++){
        if(b[i] < 1) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 2176
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll a,b,c;
    cin >>a >> b >> c;
    if((b-c)*(a-c)<0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3652
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
 
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

int main() {
   int n;
   cin >> n;
   cout << n * n * n;
    return 0;
}

Measured memory_bytes: 3512
//       Author: Mostafa Mounir Shehab
 
#include <bits/stdc++.h>
using namespace std;
 
#define PI  acos(-1)
#define EPS (1e-10)
#define endl "\n"
#define SZ(v) (int)(v.size())
#define IO ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL), cerr.tie(NULL);
typedef long long ll;
typedef long double ld;
 
 
 
ll MOD=1e9 + 7;
ll OO=1e9 + 1;
const int N=1e5 + 10,M=20;
int dp[N][M];
int arr[N];
int LOG[N];

int n,m,k,T,ans;
int a,b,c;
int l,r,mid;
string str;

int main(){
	IO
	//freopen("in.txt","r",stdin);
	cin>>str;
	for(char &i:str)
		n += (i-'0');
	
	if(n%9 == 0)
		cout<<"Yes\n";
	else
		cout<<"No\n";
	
}

 

Measured memory_bytes: 3712
#[allow(unused)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
#[allow(unused)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
#[allow(unused)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        v: [u64;n],
    }
    let mut c: u64;
    c = 1;

    for elem in v.iter() {
        if elem * 1 == 0 {
            println!("0");
            return;
        }
    }

    for elem in v.iter() {
        if c == 0 {
            println!("0");
            return;
        }
        if 1000000000000000000 / c < elem * 1 {
            println!("-1");
            return;
        }
        c = c * elem;
    }
    println!("{}", c);
}


Measured memory_bytes: 2712