akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#define my_abs(x) ((x) < 0 ? -(x) : (x))
#define mp std::make_pair
#define pb push_back
typedef long long ll; 
int arr[200005]; 
int main()
{
	// freopen("AGC024-C.in", "r", stdin); 
	int n; 
	scanf("%d", &n); 
	for (int i = 0; i < n; i++)
		scanf("%d", arr + i); 
	int cur = n;
	long long ans = 0; 
	for (int i = n - 1; i >= 0; i--)
	{
		if (i - arr[i] + 1 == cur)
			continue; 
		if (i - arr[i] + 1 >= cur)
		{
			puts("-1"); 
			return 0; 
		}
		ans += arr[i]; 
		cur = i - arr[i] + 1; 
		if (cur <= 0)
		{
			puts("-1"); 
			return 0; 
		}
	}
	printf("%lld\n", ans);
	return 0; 
}


Measured memory_bytes: 1152
fn s(n: usize) -> usize {
    let mut n = n;
    let mut result = 0;
    while n > 0 {
        result += n % 10;
        n /= 10;
    }
    result
}

fn next(x: usize) -> usize {
    let mut result = x + 1;
    let mut cur = 10;
    loop {
        let prefix = x / cur;
        for i in 0..11 {
            let candidate = (prefix / 10 * 10 + i) * cur + cur - 1;
            if candidate <= x {
                continue;
            }
            if candidate * s(result) < s(candidate) * result {
                result = candidate;
            }
        }
        cur *= 10;
        if prefix == 0 {
            break;
        }
    }
    result
}

fn main() {
    let mut sc = Scanner::new();
    let mut k = sc.usize_read();
    for i in 1..10 {
        println!("{}", i);
        k -= 1;
        if k == 0 {
            return;
        }
    }
    let mut cur = 9;
    while k > 0 {
        cur = next(cur);
        println!("{}", cur);
        k -= 1;
    }
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        Scanner {
            ptr: 0,
            length: 0,
            buf: vec![0; 1024],
            small_cache: vec![0; 1024],
        }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool {
        b == b'\n' || b == b'\r' || b == b'\t' || b == b' '
    }

    fn read_vec<T>(&mut self, n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        (0..n).map(|_| self.read()).collect()
    }

    fn usize_read(&mut self) -> usize {
        self.read()
    }

    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)])
                    .parse()
                    .unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}


Measured memory_bytes: 4352
def gcd(a,b):
  if b>a:
    a,b=b,a
  while a%b:
    a,b=b,a%b
  return b


A,B,C,D = map(int,input().split())
mul = C*D//gcd(C,D)
mi = (A-1) // mul
ma = B // mul
mv = ma-mi
#print(mv)
ci = (A-1) // C
ca = B // C
cv = ca-ci
#print(cv)
di = (A-1) // D
da = B // D
dv = da-di
#print(dv)
print(B-A-cv-dv+mv+1)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        int sum = 0;

        for(char each : a.toCharArray()){
            sum += each - '0';
        }
        String res = sum % 9 == 0 ? "Yes" : "No";
        System.out.println(res);
    }
}

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

using namespace std;

#define ll       long long
#define PII      pair<int, int>
#define READ(f)  freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

const int N = 3e5 + 5;
const int MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);

int main() {
    int a, b;
    cin >> a >> b;
    map<int, int> mp;
    mp[a] = mp[b] = 1;
    for (int i = 1; i <= 3; i++) {
        if (mp[i] == 0) {
            cout << i << '\n';
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		BigInteger ans = BigInteger.ONE;
		for(int i=1;i<=n;i++) {
			ans=ans.multiply(BigInteger.valueOf(i));
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 17228
#include "bits/stdc++.h"
using namespace std;
 
#define all(x)  x.begin(), x.end()
 
int n;
int used[2020];
vector<int> a, ans;
 
void dfs(int v) {
        used[v] = true;
        ans.push_back(a[v]);
        for (int u = 0; u < n; u ++) {
                if (!used[u] && __gcd(a[v], a[u]) != 1) dfs(u);
        }
}
 
int main() {
        scanf("%d", &n);
        a.resize(n);
        for (int i = 0; i < n; i ++) scanf("%d", &a[i]);
        sort(all(a));
        for (int i = 0; i < n; i ++) if (!used[i]) dfs(i);
        for (int i = 0; i < n; i ++) {
                int p = i;
                for (int j = i - 1; j >= 0 && __gcd(ans[i], ans[j]) == 1; j --) {
                        if (ans[j] < ans[i]) p = j;
                }
                rotate(ans.begin() + p, ans.begin() + i, ans.begin() + i + 1);
        }
        for (int i = 0; i < n; i ++) cout << ans[i] << (i == n - 1 ? '\n' : ' ');
        return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<int> vi;
typedef pair<int,int> ii;
#define inf 1e9
#define F first
#define S second
#define dbg(x) cout<<#x<<" value : "<<x<<"\n";
#define rep(i,j,k) for(int i = (j); i <= (k); i++)
#define rep__(i,j,k) for(int i = (j); i < (k); i++)
#define per(i,j,k) for(int i = (j); i >= (k); i--)
#define per__(i,j,k) for(int i = (j); i > (k); i--)
#define mst(a,b) memset(a,b,sizeof(a))
#define sf(n) scanf("%d",&n)
#define stf(n,m) scanf("%d%d",&n,&m)
#define pf(n) printf("%d\n",n)
#define slf(n) scanf("%lld",&n)
#define plf(n) printf("%lld\n",n)
priority_queue<int,vector<int>,less<int> > q;
const int N=1e3+10;
const int mod=1e9+7;
int main()
{
	int n;
	string s;
	sf(n);
	cin>>s;
	if(n<3200)printf("red");
	else cout<<s;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>
#include <array>

template <class T, class U>
inline bool chmin(T &lhs, const U &rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T &lhs, const U &rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct range {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr range(int l_, int r_): l(l_), r(std::max(l_, r_)) { }
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct revrange {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr revrange(int l_, int r_): l(l_ - 1), r(std::max(l_, r_) - 1) { }
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

constexpr int N = 500;

int main() {
  int K;
  std::cin >> K;
  if (K <= N) {
    std::cout << K << '\n';
    for (int i: range(0, K)) {
      for (int j: range(0, K)) {
        std::cout << i + 1 << " \n"[j + 1 == K];
      }
    }
  }
  else {
    std::cout << N << '\n';
    std::array<std::array<int, N>, N> ans;
    for (int i: range(0, N)) {
      for (int j: range(0, N)) {
        ans[i][j] = (i + j) % N;
        if (j & 1 && ans[i][j] < K - N) {
          ans[i][j] += N;
        }
      }
    }
    for (int i: range(0, N)) {
      for (int j: range(0, N)) {
        std::cout << ans[i][j] + 1 << " \n"[j + 1 == N];
      }
    }
  }
  return 0;
}


Measured memory_bytes: 2176
x1,y1,x2,y2 = map(int,input().split(' '))
a = x2 - x1
b = y2 - y1

x3 = x1 + a - b
y3 = y1 + a + b
x4 = x1 - b
y4 = y1 + a

print("{0} {1} {2} {3}".format(x3,y3,x4,y4))

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>

#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
#include <iterator>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF (1<<30)
#define ALEN(ARR) (sizeof(ARR) / sizeof((ARR)[0]))
#define MP make_pair
#define mp make_pair
#define pb push_back
#define PB push_back

#if DEBUG
#define _DEBUG(x) cout<<#x<<": "<<x<<endl
#define _DDEBUG(x,y) cout<<#x<<": "<<x<<", "<<#y<<": "<<y<<endl
#else
#define _DEBUG(x) ;
#define _DDEBUG(x,y) ;
#endif

#define ll long long
#define ull unsigned long long
#define MOD 1000000007

/** FOR VECTOR DEBUG */
template <typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
    if ( !v.empty() ) {
        out << '[';
        copy (v.begin(), v.end(), ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}


/* template end */
int dp[200010][5];

int min_num(int a[], int l) {
    int r = INF;
    for(int i = 0; i <= l; i++) {
        r = min(r, a[i]);
    }
    return r;
}

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

    int n;
    cin >> n;
    vector<int> v(n);
    REP(i, n) {
        cin >> v[i];
    }

    for(int i = 0; i < n + 1; i++) {
        for(int j = 0; j < 5; j++) {
            dp[i][j] = INF;
        }
    }
    dp[0][0] = 0;

    for(int i = 0; i < n; i++) {
        for(int j = 0; j < 5; j++) {
            int add_cost = [&] {
                if(j == 0 || j == 4) {
                    return v[i];
                }
                if(j == 1 || j == 3) {
                    return v[i] == 0 ? 2 : v[i] % 2;
                }
                return (v[i] % 2) ^ 1;
            }();
            dp[i + 1][j] = min(dp[i + 1][j], min_num(dp[i], j) + add_cost);
        }
    }

    int ans = INF;
    REP(i, 5) {
        ans = min(ans, dp[n][i]);
    }

#if DEBUG
    cout << "** RESULT **" << endl; // debug
#endif
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (ll I = (A); I <= (B); I++)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(ll i=0;i<n;i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl
#define scan(char_array) scanf("%[^\n]s",&char_array)
#define inin freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

int main(){
    //inin
    IOS
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll ans=0;
    if(k<a) {ans+=k; k=0;}
    else if(k>0) {ans+=a; k-=a;}

    if(k>0&&k<b) {ans+=0; k=0;}
    else if(k>0) {ans+=0; k-=b;}

    if(k>0&&k<c) {ans-=k; k=0;}
    else  if(k>0) {ans-=c; k-=c;}

    cout<<ans<<endl;




}

Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {

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

		double wSide = (double)len/3;
		double tSide = (double)len/3;
		double hSide = (double)len/3;

		double result = wSide*tSide*hSide;

		System.out.print(result);
		sc.close();
	}
}


Measured memory_bytes: 21076
import itertools


def solve():
    ABC = tuple(map(int, input().split()))
    # print(ABC)

    permus = tuple(itertools.permutations((0, 1, 2), 3))
    for a, b, c in permus:
        if ABC[a] == ABC[b] + ABC[c]:
            return True
        if ABC[a] + ABC[b] == ABC[c]:
            return True

    return False


if __name__ == '__main__':
    res = solve()
    if res:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 38384
import java.io.*;
import java.math.*;
import java.util.*;
import java.text.*;
public class Main {
	   static int N=1010;
	   static int n;
	   static Double []x=new Double[N];
	   static Double []y=new Double[N];
	   static Double []r=new Double[N];
	   static Double []dist=new Double[N];
	   static Double [][]map1=new Double[N][N];
	   static int[] vis=new int[N];
       public static void main(String[] args) {
    	  Scanner cin=new Scanner(new BufferedInputStream(System.in));
          String string =cin.next();
          int len=string.length();
          string+="       ";
          String s1="dream",s2="erase";
          int flag=1;
          for(int i=0;i<len;i++)
           {
        	  if(flag==0) break;
        	  if(string.charAt(i)=='d') {
        		  int j;
        		  for(j=i+1;j<=i+4;j++)
        			 if(string.charAt(j)!=s1.charAt(j-i)){
        				 flag=0;break;
        			 }
        		  if(flag==0) break;
        		  i=j;
                  if(string.charAt(i)=='e'&&string.charAt(i+1)=='r'){
                	  if(string.charAt(i+2)=='e'||string.charAt(i+2)=='d'||i+2==len)
                		  i=i+1;
                	  else i=j-1;
                  }
                  else i=j-1;
               }
        	  else if(string.charAt(i)=='e'){
        		  int j;
        		  for(j=i+1;j<=i+4;j++){
        			 if(string.charAt(j)!=s2.charAt(j-i)){
        				 flag=0;
        				 break;
        			 }
        		   }
        		  if(flag==0) break;
        		  i=j;
                  if(string.charAt(i)=='r'){
                	  if(string.charAt(i+1)=='e'||string.charAt(i+1)=='d'||i+1==len)
                		  i=i;
                	  else i=j-1;
                  }
                  else i=j-1;
        	  }
        	  else {
        		 flag=0;break;
			  }
        	  if(flag==0) break;
           }
          if(flag==0) System.out.println("NO");
          else System.out.println("YES");      
	}
}

Measured memory_bytes: 45752
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem D

if __name__ == '__main__':
    number, k = list(map(int, input().split()))
    count = 0

    # HACK: Not beautiful.
    if k == 0:
        print(number ** 2)
    else:
        for b in range(1, number + 1):
            p = (number + 1) // b
            r = number - (p * b)
            count += p * max(0, b - k)

            if (number + 1) % b != 0:
                count += max(0, r - k + 1)

        print(count)


Measured memory_bytes: 3060
n=int(input())
a=list(map(int,input().split()))
t=[0]*n
p=[]
g=0
for i in range(n-1,-1,-1):
    if sum(t[i::i+1])%2!=a[i]:
        t[i]=1
        p.append(i+1)
        g+=1
print(g)
print(*p[::-1])

Measured memory_bytes: 14776
#include<iostream>
#include<string>
#include<map>
#include<cstdlib>

using namespace std;

int main(){
	string in;
	map<int,int> c,d;
	map<int,int>::iterator p;
	
	
	//¡ÌÇÝÝ
	while(getline(cin,in)){
		if(in.size()==0)break;
		int n=atoi(in.c_str());
		p=c.find(n);
		if(c.end()==p)c.insert(pair<int,int>(n,1));
		else ++(p->second);
	}
	
	//æÌÇÝÝðµÄdÉ¡ÌªÆ í¹ÄüÍ
	//½¾µA¡ÌæøªÈ¢àÌÍòÎµÄÜ·B
	while(getline(cin,in)){
		int n=atoi(in.c_str());
		p=c.find(n);
		if(c.end()==p)continue;
		else{
			if(d.find(n)==d.end())d.insert(pair<int,int>(n,p->second+1));
			else d.find(n)->second++;
		}
	}
	
	//æÌf[^ðoÍ
	for(p=d.begin();p!=d.end();++p){
		cout<<(p->first)<<" "<<(p->second)<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()

n = int(input())
k = int(input())
x = int(input())
y = int(input())

temp = min([n,k]) * x
if k<n:
    temp += (n-k) * y
print(temp)

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void push(int);
int  pop( );

int main(){
  int x,y;
  int top = 0;
  char s[100];


  while(scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      x = pop( );
      y = pop( );
      push(x+y);

    } else if ( s[0] == '-' ){
      y = pop( );
      x = pop( );
      push(x-y);

    } else if ( s[0] == '*' ){
      x = pop( );
      y = pop( );
      push(x*y);

    } else {
      push(atoi(s));

    }
  }
  printf("%d\n",pop( ));
  return 0;
}

int top,S[1000];
void push(int x){
  S[++top] = x;
}

int pop( ){
  top--;
  return S[top+1];
}



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

int main() {
  	string s; 
  	cin >> s;
  	for (int i = 2; i < 5; i += 2)
    	if (s[i] != s[i+1])
      		cout << "No", exit(0);
  	cout << "Yes"; }
  

Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define Yes(condition) if(condition){ cout << "Yes" << '\n'; }else{ cout << "No" << '\n'; }
#define YES(condition) if(condition){ cout << "YES" << '\n'; }else{ cout << "NO" << '\n'; }
#define yes(condition) if(condition){ cout << "yes" << '\n'; }else{ cout << "no" << '\n'; }




int n;
vector<ll> a;

bool ok(ll x){
    map<ll, ll> mp;
    for(ll i = 1; i < n; i++){
        if(a[i - 1] >= a[i]){
            mp.erase(mp.lower_bound(a[i] + 1), mp.end());
            mp[a[i]]++;
            ll t = a[i];
            while(mp[t] >= x && t > 1){
                mp[t - 1] += mp[t] / x;
                mp[t] %= x;
                t--;
            }
        }
    }
    return (mp[1] < x)? true : false;
}

int main() {
    cin >> n;
    a.resize(n);
    REP(i, n){
        cin >> a[i];
    }
    bool f = true;
    for(ll i = 1; i < n; i++){
        if(a[i - 1] >= a[i]){
            f = false;
            break;
        }
    }
    if(f){
        cout << 1 << endl;
        return 0;
    }
    ll l = 1, r = 1e10;
    while(r - l > 1){
        ll c = (l + r) / 2;
        if(ok(c)){
            r = c;
        }
        else{
            l = c;
        }
    }
    cout << r << endl;
}


Measured memory_bytes: 1792
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

ll dp[1 << 20];

ll V[51];
vector<pair<int, int>> E[51];
void dfs(int p, ll v, int mae) {
	V[p] = v;
	for (auto pr : E[p]) {
		int to = pr.first;
		if (mae != to) {
			v ^= 1ll << pr.second;
			dfs(to, v, p);
			v ^= 1ll << pr.second;
		}
	}
}

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


	int N;
	cin >> N;
	rep(i, N - 1) {
		int a, b;
		cin >> a >> b;
		E[a].pb(mp(b, i));
		E[b].pb(mp(a, i));
	}

	dfs(1, 0, 0);

	int M;
	cin >> M;
	int list[51] = {};
	rep(i, M) {
		int u, v;
		cin >> u >> v;

		rep(j, N - 1) list[j] ^= (V[u] >> j & 1ll) << i;
		rep(j, N - 1) list[j] ^= (V[v] >> j & 1ll) << i;
	}

	dp[0] = 1;
	rep(i, N - 1) {
		for (int j = (1 << M) - 1; j >= 0; j--) {
			dp[j | list[i]] += dp[j];
		}
	}

	co(dp[(1 << M) - 1]);


	Would you please return 0;
}

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

int find(int n) {
  int res = 0;
  while (n > 0) {
    res += (n % 10);
    n /= 10;
  }
  return res;
}

int main(void){
  int N,X;
  cin >> N;
  int res = find(N);
  if(N % res == 0){
    cout << "Yes" << endl;
  }else {
    cout << "No"  <<endl;
  }
  return 0;
}


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

int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    for(int i=0; i<ty-sy ; i++) cout << "U";
    for(int i=0; i<tx-sx+1; i++) cout << "R";
    for(int i=0; i<ty-sy+1; i++) cout << "D";
    for(int i=0; i<tx-sx+1; i++) cout << "L";

    cout << "UL";

    for(int i=0; i<ty-sy+1; i++) cout << "U";
    for(int i=0; i<tx-sx+1; i++) cout << "R";
    for(int i=0; i<ty-sy+1; i++) cout << "D";
    for(int i=0; i<tx-sx  ; i++) cout << "L";

    return 0;
}

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

int main() {
  string S,T; cin>>S>>T;
  int ans = (int)T.length();
  // 該当するTの文字を、どこからたどるか
  for(int i=0; i<(int)T.length(); ++i) {
    for(int j=i; j<(int)S.length()-(int)T.length()+1+i; ++j) {
      if(S[j]==T[i]) {
        int count = (int)T.length();
        for(int k=0; k<(int)T.length()-i; ++k) {
          if(S[j+k]==T[i+k]) count--;
        }
        ans=min(ans,count);
      }
    }
    cout << endl;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3600
import Control.Monad
f s p n m=(((take m).(drop n)).map ((take m).(drop p))) s
g a b l r=if r+(length b) > length a then False else if l+(length b) > length a then  g a b 0 (r+1) else
          if b==f a l r (length b) then True else g a b (l+1) r
main=do
 [n,m]<-map read.words<$>getLine
 a<-replicateM n getLine
 b<-replicateM m getLine
 putStrLn$if g a b 0 0 then"Yes"else"No"

Measured memory_bytes: 1148
#include <stdio.h>

int main()
{
  int n,ans;

  scanf("%d", &n);

  if(n<10){
    ans = n;
  }else if(10 <= n && n < 100){
    ans = 9;
  }else if(100 <= n && n < 1000){
    ans = n-90;
  }else if(1000 <= n && n < 10000){
    ans = 909;
  }else if(10000 <= n && n < 100000){
    ans = n-9090;
  }else  {
    ans = 90909;
  }
  
  printf("%d", ans);

}


Measured memory_bytes: 1708
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
#include<functional>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  ll i,j,n,m,k;
  cin >> n >> m >> k;
  vector<ll> a(n),b(m);
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  for(i=0;i<m;i++){
    cin >> b[i];
  }
  vector<ll> x(n+10,0),y(m+10,0);
  for(i=0;i<n;i++){
    x[i+1]=x[i]+a[i];
  }
  for(i=0;i<m;i++){
    y[i+1]=y[i]+b[i];
  }
  ll ans=0;
  for(i=0;i<n+1;i++){
    if(k<x[i]){
      break;
    }
    ll min=-1,max=m+1,mid;
    while(abs(min-max)>1){
      mid=(min+max)/2;
      if(y[mid]<=k-x[i]){
        min=mid;
      }
      else{
        max=mid;
      }
    }
    if(ans<min+i){
      ans=min+i;
    }
  }
  cout << ans << endl;
}

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

int main(){
	int N; cin >> N;
	vector<ll> A(N);
	for(int i=0; i<N; i++){
		cin >> A[i];
	}
	
	ll ans = 1;
	sort(A.begin(),A.end());
	if(A[0] == 0){cout << 0 << endl; return 0;}
	for(int i=0; i<N; i++){
		if(A[i] <= 1000000000000000000LL/ans){
			ans *= A[i]; 
		} else {
			cout << -1 << endl; return 0;
		}
	}
	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 4052
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int c = Integer.parseInt(sc.next());
		System.out.println((b - a == c - b)? "YES" : "NO");
	}
}

Measured memory_bytes: 21844
// #pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vll = vector<ll>;
using vii = vector<int>;
using pii = pair<int, int>;
template <typename T = vii>
using vec = vector<T>;

const ll INF = 1e18, MOD = 1e9 + 7;

const int N = 12, MAX = 1 << N;

int main() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    // freopen("in.in", "r", stdin);

    int n, m;
    cin >> n >> m;
    vec<pii> v(m);
    for (auto& p : v) {
        cin >> p.first;
        int b;
        cin >> b;
        for (int i = 0; i < b; i++) {
            int c;
            cin >> c;
            p.second |= 1 << (c - 1);
        }
    }
    const int lim = 1 << n;
    vll dp(lim, INF);
    dp[0] = 0;
    for (auto p : v) {
        auto new_dp = dp;
        const int cost = p.first, cur = p.second;
        for (int mask = 0; mask < lim; mask++) {
            const int new_mask = mask | cur;
            new_dp[new_mask] = min(new_dp[new_mask], dp[mask] + cost);
        }
        dp = move(new_dp);
    }

    cout << (dp.back() == INF ? -1 : dp.back()) << '\n';
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main(){

	long long sum = 0, n,a,max=-1000000, min=1000000;

	cin >> n;
	for (int i=0;i<n;i++) {
		cin>>a;

		if (a > max) {
			max = a;
		}
		if (a < min) {
			min = a;
		}
		sum = sum + a;
	}
	cout << min <<" "<< max <<" "<< sum << endl;

return 0;
}


Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n; cin >> n;
    string s; cin >> s;
    int ans =0; int ch =-1;
    for (int x=0;x<n;x++){
        if ((int)s[x]==ch) continue;
        else{
            ch = (int)s[x];
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3704
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws IOException {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }
        String arr01[] = mylist.get(0).split(" ");
        String arr02[] = mylist.get(1).split(" ");
        String n = arr01[0];

        int cnt = 0;
        Boolean chkflg = true;

        for (int i = 1; i <= Integer.valueOf(n); i++) {
            if (Integer.valueOf(arr02[i - 1]) != i) {
                cnt += 1;
            }
            if (cnt > 2) {
                chkflg = false;
                break;
            }
        }

        System.out.println(chkflg ? "YES" : "NO");
    }

}

Measured memory_bytes: 21332
#include <stdio.h>

int main(void)
{
	int a,b,c;
	int i;
	int count = 0;
	
	scanf("%d %d %d",&a,&b,&c);
	
	for(i=a;i<=b;i++)
	{
		if(c%i == 0)
		{
			count++;
		}
	}
	
	printf("%d\n",count);
	
	return 0;
}

Measured memory_bytes: 1844
N = int(input())

N_3 = int(N / 3)
N_5 = int(N / 5)
N_15 = int(N / 15)

def sumN(n):
    return int(n * (n + 1) / 2)

print(sumN(N) - sumN(N_3) * 3 - sumN(N_5) * 5 + sumN(N_15) * 15)


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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 3007;
const double pi = acos(-1.00);

int n;
double loc[_],len;

int main()
{
	n=ty(),len=ty();
	for(int i=1;i<=n;i++)loc[i]=ty(),loc[i]=loc[i]*pi*2/len;

	sort(loc+1,loc+n+1);
	
	double sx=0,sy=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			double a=(loc[i]+loc[j])/2;
			sx+=cos(a)*(n-(j-i+1)),sy+=sin(a)*(n-(j-i+1));
			sx+=cos(a+pi)*(j-i-1),sy+=sin(a+pi)*(j-i-1);
		}
	}

	double all=1.00*n*(n-1)*(n-2)/6;
	printf("%.15lf %.15lf\n",sx/all,sy/all);

	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>

using namespace std;

unsigned long long gcd(unsigned long long a, unsigned long long b) {
    if (a > b) swap(a, b);
    while (a != 0) {
        auto tmp = a;
        a = b % a;
        b = tmp;
    }
    return b;
}

unsigned long long scm(unsigned long long a, unsigned long long b) {
    return a / gcd(a, b) * b;
}

bool check(const vector<int> &data) {
    int d = 2;
    while (data[0] % d == 0) d <<= 1;
    int d0 = d / 2;
    for (auto e: data) {
        if (e % d0 || (e % d == 0))
            return false;
    }
    return true;
}

int main(int argc, char* argv[]) {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (auto &el: a)
        cin >> el;
    if (!check(a))
        cout << 0 << endl;
    else {
        unsigned long long v = a[0] / 2;
        for (auto el: a) {
            if (v > m)
                break;
            v = scm(v, el / 2);
        }
        int tmp = m / v;
        cout << (tmp + 1) / 2 << endl;
    }
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define P pair<int,int>
#define All(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
typedef long long ll;
using namespace std;
const int INF = 1e9, MOD = 1e9 + 7;
const ll LINF = 1e18;
int main() {
	string s;
	cin >> s;
	sort(All(s));
	int size = s.size();
	for (int i = 0; i < size; i += 2) {
		if (s[i] != s[i + 1]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int sum(int x){
  int w=0;
  for(int i=1;i<=x;i++) w=w+i;
  return w;
}
int main(){
  int a,b;
  cin>>a>>b;
  
  cout <<sum(b-a)-b <<endl;
}

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


int main()
{

    string s;
    cin>>s;
    bool f=false;
    map<char,int>mp;
    for(int i=0;i<s.size();i++)
    {
        mp[s[i]]++;
    }
    for(auto x:mp)
    {
        if(x.second&1)
        {
            f=true;break;
        }
    }
    if(f)cout<<"No"<<"\n";
    else cout<<"Yes"<<"\n";
}



Measured memory_bytes: 3604
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main(void) {
  int n;
  long long a[100000];
  cin>>n;
  for(int i=0; i<n; i++) {
    cin>>a[i];
  }
  sort(a, a+n);
  double x=double(a[n-1])/double(2);
  long long ans=a[n-1];
  long long c=a[0];
  for(int i=0; i<n; i++) {
    if(ans>abs(x-a[i])) {
      ans=abs(x-a[i]);
      c=a[i];
    }
  }
  cout<<a[n-1]<<" "<<c<<endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

int main() {
    int N, H, W;
    cin >> N >> H >> W;
    cout << (N - H + 1) * (N - W + 1) << endl;
}

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

int main()
{
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  if (a != 1)
  {
    cout << "1" << endl;
    return 0;
  }
  if (b != 2)
  {
    cout << "2" << endl;
    return 0;
  }
  if (c != 3)
  {
    cout << "3" << endl;
    return 0;
  }
  if (d != 4)
  {
    cout << "4" << endl;
    return 0;
  }
  if (e != 5)
  {
    cout << "5" << endl;
    return 0;
  }
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
int n,q,head[N],nex[N<<1],to[N<<1];
int tot=1;void add(int u,int v){to[++tot]=v;nex[tot]=head[u];head[u]=tot;}
ll dp[N];
void dfs(int u,int p)
{
    for(int i=head[u];i;i=nex[i])
    {
        int v=to[i];if(v==p) continue;
        dp[v]+=dp[u];
        dfs(v,u);
    }
}
int main()
{
    scanf("%d%d",&n,&q);
    for(int i=1;i<n;i++)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        add(u,v);add(v,u);
    }
    while(q--)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        dp[x]+=y;
    }
    dfs(1,0);
    for(int i=1;i<=n;i++)
        printf(i==n?"%lld\n":"%lld ",dp[i]);
}


Measured memory_bytes: 17280
#include <iostream>
#include <algorithm>
#include <string>
#include <set>

using namespace std;

int main(int, char**) {
  set<int> e;
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    if (e.find(a) != e.end()) {
      cout << "NO\n";
      return 0;
    }
    e.insert(a);
  }
  cout << "YES\n";
  
  return 0;
}

Measured memory_bytes: 9600
/*
    Author:zeke

    pass System Test!
    GET AC!!
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
// cout << "Case #" << index << " :IMPOSSIBLE";

VV graph(16);
ll cnt=0;
void dfs(ll now,ll prev){
    if(now==15){
        cnt++;
    }
    for(auto dst:graph[now]){
        if(dst==prev){
            continue;
        }
        dfs(dst,now);
    }
    return;
}
//powMod(a,b,MOD)
//O(log(b))?
struct UnionFind
{
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N)
    { //最初は全てが根であるとして初期化
        for (int i = 0; i < N; i++)
            par[i] = i;
    }

    int root(int x)
    { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {                     // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry)
            return;   //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y)
    { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
/*
実装例
int main(){
    UnionFind tree(V);
    //UnionFind 構造体のインスタンス化　まず最初にこれを書いてください　Vは頂点数を入れてください(頂点数初期化)
    tree.unite(x,y);//xとyの頂点をつなげる
    tree.same(x,y);//xとyが同じグループに存在するかどうか
    tree.root(x);//xの根を返す
}
*/
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    ll n,m;
    cin>>n>>m;
    UnionFind tree(n);
    rep(i,m){
        ll x,y,z;
        cin>>x>>y>>z;
        x--;y--;
        tree.unite(x,y);
    }
    set<ll> st;
    rep(i,n){
        st.insert(tree.root(i));
    }
    cout<<st.size()<<endl;
}


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

int main()
{
	vector<int> v[21];
	int n, m, c, b[21], temp;
	cin >> n >> m >> c;
	for (int i = 0; i < m; i++)
		cin >> b[i];
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j <m; j++)
		{
			cin >> temp;
			v[i].push_back(temp);
		}
	}
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		int s = 0;
		for (int j = 0; j <m; j++)
		{
			s += v[i][j] * b[j];
		}
		if (s + c > 0)
			ans++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N;
	scanf("%d",&N);
    long long sum=0;
	for(int i=1;i<=N;i++){
		if(i%3==0||i%5==0)
		continue;
		sum+=i;
	}	
	printf("%lld",sum);
	return 0;
} 

Measured memory_bytes: 3828
using System;
using System.Linq;

class abc126_A
{
    static void Main(string[] args)
    {
        var line = readLongs();
        var QN = line[0];
        var QK = line[1];
        var QS = Console.ReadLine();

        var a = QS.ToCharArray();
        a[QK-1] = Char.ToLower(a[QK-1]);
        var str = String.Join("", a);
        Console.WriteLine(str);
    }

    
    static long[][] readLongsN(int N) { return Enumerable.Range(0, N).Select(x => readLongs()).ToArray(); }

    static long readLong() { return long.Parse(Console.ReadLine()); }

    static long[] readLongs() { return Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray(); }

}

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

long long N, M, L, Q;
long long d[305][305];
long long d2[305][305];

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

	for(long long i = 0; i < N; i++){
		for(long long j = 0; j < N; j++){
			d[i][j] = LONG_MAX/4;
			d2[i][j] = LONG_MAX/4;
		}
		d[i][i] = 0;
		d2[i][i] = 0;
	}

	for(long long i = 0; i < M; i++){
		long long a,b,c;
		cin >> a >> b >> c;a--;b--;
		d[a][b] = c;
		d[b][a] = c;
	}

	for(int k = 0; k < N; ++k){
		for(int i = 0; i < N; ++i){
			for(int j = 0; j < N; ++j){
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}

	for(long long i = 0; i < N; i++){
		for(long long j = 0; j < N; j++){
			if(d[i][j] <= L){
				d2[i][j] = 1;
			}
		}
	}


	for(int k = 0; k < N; ++k){
		for(int i = 0; i < N; ++i){
			for(int j = 0; j < N; ++j){
				d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j]);
			}
		}
	}


	cin >> Q;
	for(long long i = 0; i < Q; i++){
		long long s,t;
		cin >> s >> t;s--;t--;
		if(d2[s][t] == LONG_MAX/4){
			cout << -1 << endl;
		}else{
			cout << d2[s][t] - 1<< endl;
		}
	}


	//for(long long i = 0; i < N; i++){
	//	for(long long j = 0; j < N; j++){
	//		cout << "d[" << i << "][" << j << "] = " << d[i][j] << endl;
	//	}
	//}



}


Measured memory_bytes: 1920
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
  
using namespace std;
  
static const double PI = acos(-1.0);
  
class Vec2
{
public:
    Vec2( double _x, double _y ) : x(_x), y(_y) {}
  
    double length() const { return sqrt(x*x + y*y); }
    double arg() const {
        if ( length() == 0 ) return 0.0;
        return atan2(y, x);
    }
    Vec2 normalize() const {
        if ( length() == 0 ) return *this;
        return Vec2(x/length(), y/length());
    }
  
    Vec2 operator+( const Vec2& rhs ) const { return Vec2(x+rhs.x, y+rhs.y); }
    Vec2 operator-( const Vec2& rhs ) const { return Vec2(x-rhs.x, y-rhs.y); }
    Vec2 operator*( double s ) const { return Vec2(x*s, y*s); }
    double dot( const Vec2& rhs ) const { return x*rhs.x + y*rhs.y; }
    double cross( const Vec2& rhs ) const { return x*rhs.y - y*rhs.x; }
  
private:
    double x;
    double y;
};
  
double DiffAngle( const Vec2& A, const Vec2& B )
{
    double d = fabs(A.arg()-B.arg());
    if ( d > PI ) d = 2*PI-d;
    return d;
}
  
vector<Vec2> IntSegCircle( const Vec2& A, const Vec2& B, double r )
{
    vector<Vec2> IntPoint;
    Vec2 D = B - A;
    Vec2 DU = D.normalize();
    Vec2 H = A - DU*(A.dot(DU));
    double h = H.length();
    if ( h >= r )
        return vector<Vec2>();
  
    double l = sqrt(r*r - h*h);
    double pa = (A-H).dot(DU), pb = (B-H).dot(DU);
    if ( pa < -l && -l < pb ) {
        IntPoint.push_back(H - DU*l);
    }
    if ( pa < l && l < pb ) {
        IntPoint.push_back(H + DU*l);
    }
    return IntPoint;
}
  
double IntTriCircle( const Vec2& A, const Vec2& B, double r )
{
    vector<Vec2> Int = IntSegCircle( A, B, r );
    if ( Int.empty() ) {
        return min( 0.5*r*r*DiffAngle(A,B), 0.5*A.length()*B.length()*sin(DiffAngle(A,B)) );
    } else if ( Int.size() == 1 ) {
        double area = 0.0;
        if ( A.length() > r ) {
            area += 0.5*r*r*DiffAngle(A,Int[0]);
        } else {
            area += 0.5*A.length()*r*sin(DiffAngle(A,Int[0]));
        }
        if ( B.length() > r ) {
            area += 0.5*r*r*DiffAngle(B,Int[0]);
        } else {
            area += 0.5*B.length()*r*sin(DiffAngle(B,Int[0]));
        }
        return area;
    } else {
        return 0.5*r*r*(sin(DiffAngle(Int[0],Int[1])) + DiffAngle(A,B) - DiffAngle(Int[0],Int[1]));
    }
}
  
double solve( int R, const vector<Vec2>& Poly )
{
    double area = 0.0;
    for ( size_t i = 0; i < Poly.size()-1; i++ ) {
        double coef = Poly[i].cross(Poly[i+1]) > 0 ? 1.0 : -1.0;
        area += coef * fabs(IntTriCircle(Poly[i], Poly[i+1], R));
    }
    return area;
}
  
int main()
{
    int N, R;
    cin >> N >> R;
  
    vector<Vec2> Poly;
    for ( int i = 0; i < N; i++ ) {
        double x, y;
        cin >> x >> y;
        Poly.push_back( Vec2(x,y) );
    }
    Poly.push_back( Poly.front() );
  
    printf( "%.10f\n", solve( R, Poly ) );
    return 0;
}

Measured memory_bytes: 3676
import math


def get_half_dividers(n):
    return {i for i in range(1, int(n ** 0.5) + 1) if n % i == 0}


def get_digit(n):
    return int(math.log10(n)) + 1


N = int(input())

half_dividers = get_half_dividers(N)
f_min = get_digit(N)

for d in half_dividers:
    e = N // d
    f = max(get_digit(d), get_digit(e))
    f_min = min(f_min, f)

print(f_min)


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

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

	vector<int> p( N );
	for( int i = 0; i < N; ++i ) {
		cin >> p.at( i );
	}

	int x = 0;
	for( int i = 0; i < N; ++i ) {
		if( p.at( i ) != i+1 ) {
			x += 1;
		}
	}

	cout << (x == 0 || x == 2 ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
// Given an array of integers of size ‘n’.
// Our aim is to calculate the maximum sum of ‘k’
// consecutive elements in the array.

/*{{{*/
#include<bits/stdc++.h>
#define sz(X) ((int)(X).size())
#define all(X) (X).begin(), (X).end()
#define rep(I, A, B) for (int I = (A); I <= (B); ++I)
#define repr(I, A, B) for (int I = (A); I >= (B); --I)
#define fors(I, S) for (int I = 0; S[I]; ++I)
#define get_pos(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define mp make_pair
#define pb emplace_back
#define ms0(X) memset((X), 0, sizeof((X)))
#define ms1(X) memset((X), -1, sizeof((X)))
#define len(X) strlen(X)
#define in insert
#define cn count
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef set<int> si;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T, class U> void _W(const pair<T, U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
#define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
#define DEBUG(...)
#endif
int MOD = 1e9 + 7;
/*}}}*/

const int SIZE = 1e6 + 10;

int N;
int A[20];
int x[20][20];
int y[20][20];

int counter(int x) {
	if (x == 0) return 0;
	return (x >> 1) + (x & 1);
}

void solve() {
	R(N);
	rep(i, 1, N) {
		R(A[i]);
		rep(j, 1, A[i]) {
			R(x[i][j], y[i][j]);
		}
	}
	int ans = 0;
	rep(bits, 1, (1 << N) - 1) {
		bool ok = true;
		for (int i = 1; i <= N; i++) {
			if (!(bits & (1 << (i - 1)))) continue;
			for (int j = 1; j <= A[i]; j++) {
				if (((bits >> (x[i][j] - 1)) & 1) ^ y[i][j]) ok = false;
			}
		}
		if (ok) ans = max(ans, __builtin_popcount(bits));
	}
	W(ans);
}

int main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

#define MULTITEST 0
#if MULTITEST
	CASET {
		solve();
	}
#else
	solve();
#endif
	return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int A, B;
  cin >> A >> B;
  if (A*B % 2 == 0) {
    cout << "No\n";
  } else {
    cout << "Yes\n";
  }
}


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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int A, B, K;
  cin >> A >> B >> K;
  set<int> S;
  for (int i = 0; i < K; i++) {
    if (B - A >= i) {
      S.insert(A + i);
      S.insert(B - i);
    }
  }
  for (auto s : S)
    cout << s << '\n';
  return 0;
}


Measured memory_bytes: 256