akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define endl "\n"
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define f first
#define se second
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define PI 3.14159265358979323846264338327950L


typedef long long ll;

const ll MOD =1e9+7;

bool graph[51][51];
bool vis[51];

int dfs(int vertex,int N,bool vis[51]){
    bool ok=true;
    for(int i=0;i<N;++i){
        if(vis[i]==false)
            ok=false;
    }
    if(ok)return 1;

    int ans=0;
    for(int i=0;i<N;++i){
        if(graph[vertex][i]==false)continue;
        if(!vis[i]){
            vis[i]=true;
            ans+=dfs(i,N,vis);
            vis[i]=false;
        }
    }
    return ans;
}

void solve(){
    int N,M;
    cin>>N>>M;

    for(int i=0;i<M;++i){
        int A,B;
        cin>>A>>B;
        graph[A-1][B-1]=graph[B-1][A-1]=true;
    }

    bool vis[51];
    for(int i=0;i<N;++i){
        vis[i]=false;
    }

    vis[0]=true;
    cout<<dfs(0,N,vis)<<endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 384
N, Y = map(int, input().split())
a = 10000
b = 5000
c = 1000

ans = [-1, -1, -1]
for y in range(min(N+1, Y//b+1)):
    for x in range(min(N-y+1, Y//a+1)):
        z = N - x - y
        if a*x + b*y + c*z == Y:
            ans = [x, y, z]
            break
    else:
        continue
    break
print(*ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
long long a,b,s;

int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>a>>b;
s=a+b;
if(a>0&&b>0)cout<<"Positive";


else if(a<0&&b<0&&s%2==0)cout<<"Negative";
else if(a<0&&b<0&&s%2!=0)cout<<"Positive";

else if(s==0)cout<<"Zero";
}



Measured memory_bytes: 3648
#include <cstdio>
#define N 11

int main() {
    char s1[N], s2[N], s3[N];
    scanf("%s %s %s", s1, s2, s3);
    printf("%c%c%c\n", s1[0] - 32, s2[0] - 32, s3[0] - 32);
    return 0;
}


Measured memory_bytes: 128
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n = int(input())
a = [int(i) for i in readline().split()]
b = [int(i) for i in readline().split()] + [0]


ans = 0
c = 0
for i in range(n+1):
    if c > a[i]:
        ans += a[i]
        c = b[i]
    else:
        ans += min(c+b[i],a[i])
        if c+b[i] >= a[i]:
            c = c+b[i] - a[i]
        else:
            c = 0
    
#    print(c,ans)
    
print(ans)

Measured memory_bytes: 19376
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define DBG 1
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define loop(n) rep(loop,(0),(n))
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

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

  int N, Y; cin >> N >> Y;
  Y/=1000;
  rep(i,0,N+1)rep(j,0,N+1){
    int x = Y - 10*i - 5*j;
    if(0<=x and x<=N and i+j+x==N){
      cout<<i<<" "<<j<<" "<<x<<endl;
      return 0;
    }
  }
  cout<<-1<<" "<<-1<<" "<<-1<<endl;

    return 0;
}


Measured memory_bytes: 256
function main(lines) {
  const input = lines.split(' ').map(function(a){return parseInt(a);})
  const a = input[0]
  const b = input[1]
  const c = input[2]
  
  if(a<b && b<c){
      console.log('Yes')
  } else {
      console.log('No')
  }

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 15368
package main

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

var n,k,m int
var c,d []int
var tree [][]int

func main() {
  input := Input{bufio.NewReaderSize(os.Stdin,1000000)}
  n = input.NextInt()
  tree = make([][]int,n)
  for i:=0;i<n-1;i++ {
    a,b := input.NextInts()
    tree[a-1] = append(tree[a-1],b-1)
    tree[b-1] = append(tree[b-1],a-1)
  }
  c = input.NextIntArray()
  d = make([]int,n)
  sort.Sort(sort.Reverse(sort.IntSlice(c)))
  dfs(0,-1)
  fmt.Println(m)
  fmt.Print(d[0])
  for i:=1;i<n;i++ { fmt.Print(" ");fmt.Print(d[i]) }
  fmt.Println()
}
func dfs(v,p int) {
  if d[v] == 0 { d[v] = c[k];k++ }
  for _,e := range tree[v] {
    if e == p { continue }
    if d[e] == 0 { d[e] = c[k];k++ }
    m += min(d[v],d[e])
    dfs(e,v)
  }
}
func min(n,m int) int {
  if n < m { return n }
  return m
}

type Input struct {
  reader *bufio.Reader
}
func(i *Input) NextLine() string {
  var buffer []byte
  for {
    line,isPrefix,err := i.reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func(i *Input) NextInt() int {
  n,_ := strconv.Atoi(i.NextLine())
  return n
}
func(i *Input) NextInts() (int,int) {
  s := strings.Split(i.NextLine()," ")
  x,_ := strconv.Atoi(s[0])
  y,_ := strconv.Atoi(s[1])
  return x,y
}
func(i *Input) NextIntArray() []int {
  s := strings.Split(i.NextLine()," ")
  a := make([]int,len(s))
  for i:=0;i<len(s);i++ { a[i],_ = strconv.Atoi(s[i]) }
  return a
}

Measured memory_bytes: 4352
using System;

public class hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var s = getString(n);
        for (int i = 0; i < 10000; i++)
            if (s.IndexOf(i.ToString()) < 0) { Console.WriteLine(i); break; }
    }
    public static string getString (int n)
    {
        var ret = "";
        while (true)
        {
            var s = Console.ReadLine().Trim();
            ret += s.Replace(" ", "");
            if (ret.Length == n) break;
        }
        return ret;
    }
}


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

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

    int H[N];
    bool goods[N];
    for (int i = 0; i < N; i++) {
        cin >> H[i];
        goods[i] = true;
    }

    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        if (H[a] == H[b]) goods[a] = goods[b] = false;
        else if (H[a] > H[b]) goods[b] = false;
        else if (H[b] > H[a]) goods[a] = false;
    }

    int ans = 0;
    for (int i = 0; i < N; i++) if (goods[i]) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4080
import sys
input = sys.stdin.readline
from math import gcd

MOD = 10**9+7

n,k = map(int,input().split())
res = 0

c = [0]*(k+1)

for i in range(k,1,-1):
    tmp = pow(k//i,n,MOD)
    for j in range(i*2,k+1,i):
        tmp -= c[j]
    c[i] = tmp%MOD
    res = (res+c[i]*i)%MOD

res = (res+pow(k,n,MOD)-sum(c))%MOD

print(res)







Measured memory_bytes: 70544
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
using namespace std;

#define ll long long int

const int MOD = 1000000007;

int main() {

	int N, M;
	int a[100], b[100], c[100], d[100];
	int dis, num;

	cin >> N >> M;
	for (int i = 1; i <= N; i++) {

		cin >> a[i] >> b[i];

	}
	for (int i = 1; i <= M; i++) {

		cin >> c[i] >> d[i];

	}

	for (int i = 1; i <= N; i++) {

		dis = INT_MAX;
		for (int j = 1; j <= M; j++) {

			if (dis > abs(a[i] - c[j]) + abs(b[i] - d[j])) {

				dis = abs(a[i] - c[j]) + abs(b[i] - d[j]);
				num = j;

			}

		}
		cout << num << endl;

	}

	return 0;
}

Measured memory_bytes: 256
package main

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

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt() int {
  n, _ := strconv.Atoi(NextLine())
  return n
}
func NextIntVec() []int {
  L := strings.Split(NextLine(), " ")
  N := make([]int, len(L))
  for i := range N {
    N[i], _ = strconv.Atoi(L[i])
  }
  return N
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func main() {
  N := NextInt()
  A := NextIntVec()
  find := 0
  for _, a := range A {
    if a == find + 1 { find++ }
  }
  ans := -1
  if 0 < find { ans = N - find }
  Write(ans)
  Output()
}

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

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

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

using namespace std;
typedef long long ll;

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

    int c,d;
    c = min(a,b);
    d = max(a,b);

    for(int i=1;i<=d;i++) cout << c;
    cout <<endl;

}

Measured memory_bytes: 256
#ARC092-C 2D Plane 2N Points
"""
重みなし2部マッチング問題
"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

#ネットワークフロー
#最大流,最小カット
import queue
class Dinic():
    #Dinic法,O(|E||V|**2) ※但し、実際にはもっと高速な動作

    def __init__(self, v, inf = 10**10):
        # v:頂点数
        # G:辺情報.各頂点に対し、[行き先,重み,(この辺を含めず)既に存在する行き先の辺数]
        # level:startからの距離(これはcapacityを考慮しない) bfsで毎回リセットされる
        # iter:各頂点について、どこまで調べ終わったかを記録する
        self.V = v
        self.inf = inf
        self.G = [[] for _ in range(v)]
        self.level = [0 for _ in range(v)]
        self.iter = [0 for _ in range(v)]

    def add_edge(self, from_, to, cap):
        # to: 行き先, cap: 容量, rev: 反対側の辺

        # 無向グラフの場合、G[to]の方のcapを0→capにする必要があるので注意.('rev'はそのままで良い)

        self.G[from_].append({'to':to, 'cap':cap, 'rev':len(self.G[to])})
        self.G[to].append({'to':from_, 'cap':0, 'rev':len(self.G[from_])-1})

    # sからの最短距離をbfsで計算
    def bfs(self, s):
        self.level = [-1 for _ in range(self.V)]
        self.level[s] = 0
        que = queue.Queue()
        que.put(s)
        while not que.empty():
            v = que.get()
            for i in range(len(self.G[v])):
                e = self.G[v][i]
                if e['cap'] > 0 and self.level[e['to']] < 0:
                    self.level[e['to']] = self.level[v] + 1
                    que.put(e['to'])

    # 増加パスをdfsで探す
    def dfs(self, v, t, f):
        if v == t: return f
        for i in range(self.iter[v], len(self.G[v])):
            self.iter[v] = i
            e = self.G[v][i]
            if e['cap'] > 0 and self.level[v] < self.level[e['to']]: #流れているかつ、levelが大きいなら
                d = self.dfs(e['to'], t, min(f, e['cap'])) # d:流量
                if d > 0:
                    e['cap'] -= d #使用済みの分だけcapから引く
                    self.G[e['to']][e['rev']]['cap'] += d
                    return d

        return 0

    def max_flow(self, s, t):
        flow = 0
        while True:
            self.bfs(s) #levelの更新
            # bfsでtに到達不可なら終了
            if self.level[t] < 0 : return flow
            #イテレータの初期化(イテレータ：各頂点に対し、どこまで調べ終わったか)
            self.iter = [0 for _ in range(self.V)]
            f = self.dfs(s, t, self.inf) #f:そのパスの流量
            while f > 0:
                flow += f
                f = self.dfs(s,t, self.inf)

n = int(readline())
red = []
blue = []
for i in range(n):
    x,y = map(int,readline().split())
    red.append([x,y])
for i in range(n):
    x,y = map(int,readline().split())
    blue.append([x,y])

N = 2*n
network = Dinic(N+2) #source=0,sink=n+1
source = 0
sink = N+1

red.sort()
blue.sort()

for b,i in enumerate(blue,1):
    for r,j in enumerate(red,1):
        if i[0] > j[0] and i[1] > j[1]:
            network.add_edge(b,n+r,1)
        elif i[0] <= j[0]:
            break

for i in range(1,n+1):
    network.add_edge(source,i,1)
    network.add_edge(n+i,sink,1)

print(network.max_flow(source,sink))

Measured memory_bytes: 50264
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	ll n, a, b; scanf("%lld%lld%lld", &n, &a, &b);
	ll ans = n / (a+b) * a;
	ans += min(a, n % (a+b));
	printf("%lld\n", ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[128],t[128],a[512];
int main()
{
	int i,n,j=0;
	cin>>n;
	scanf("%s %s",s,t);
	for(i=0;i<n;i++)
	{
		a[j++]=s[i];
		a[j++]=t[i];
	}
	printf("%s",a);
    return 0;
}

Measured memory_bytes: 256
//It doesn't matter how slow you go, Unless you don't stop.
#include<iostream>
#include<algorithm>
#include<bitset>
 
#include<cmath>
#include<cstring>
#include<climits>
 
#include<deque>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
 
#include<fstream>
#include<chrono>
using namespace std;
 
typedef long long LL;
typedef pair<LL,LL> p64;
typedef vector<LL> v64;
typedef map<LL,LL> mp64;
 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i,s,e) for(long long i=s;i<=e;i++)
#define brep(i,s,e) for(long long i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define DANGER std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
 
void solve()
{
     int k;cin>>k;
     int res=0;
     for(int i=1;i<=k;i++)
     {
         for(int j=1;j<=k;j++)
         {
             for(int p=1;p<=k;p++)
             {
                 int dummy = __gcd(i,j);
                 int dmy = __gcd(dummy,p);
                 res += dmy;
             }
         }
     }
     cout<<res<<endl;
}
 
int main()
{
    DANGER;
    ofstream out("output.txt");
 
    auto start = chrono::high_resolution_clock::now();
    
    LL t = 1;
    // cin>>t;
    rep(test,1,t)
    {
        solve();
    }
    
    auto stop = chrono::high_resolution_clock::now();
    // auto duration = chrono::duration_cast<chrono::milliseconds>(stop - start); 
    // cout << "Time taken by function: " << duration.count() << " milliseconds" << endl;
}

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

#define INF 1E18



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

    int a[9] = {111,222,333,444,555,666,777,888,999};

    rep(i,9){
        if(n<=a[i]){
            cout << a[i] <<endl;
            return 0;
        }
    }


    return 0;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_N 200000
i64 N;
i64 memo[10][10];

void solve() {
  i64 cnt = 0;

  string si;
  i64 cnt1, cnt2;
  char ac, bc;
  REP(a, 10) {
    for (i64 b = a; b <= 9; b++) {
      ac = '0' + a;
      bc = '0' + b;
      cnt1 = 0;
      cnt2 = 0;
      REPS(i, N) {
        si = to_string(i);
        if (si[0] == ac && si[si.length() - 1] == bc) cnt1++;
        if (si[0] == bc && si[si.length() - 1] == ac) cnt2++;
      }
      memo[a][b] = cnt1;
      memo[b][a] = cnt2;
    }
  }

  REP(a, 10) {
    REP(b, 10) {
      cnt += memo[a][b] * memo[b][a];
    }
  }

  cout << cnt << endl;
}

int main() {
  cin >> N;

  solve();

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(5e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int h, w, d[35][35];
int row[35][35], cul[35][35];

bool isIn(int i, int j){
    return i>=0 && i<h && j>=0 && j<w;
}

int bfs(){
    REP(i,h)fill(d[i],d[i]+w,IINF);
    queue<P> que;
    que.push({0,0});
    d[0][0] = 1;
    while(!que.empty()){
        P p = que.front();
        que.pop();
        int pi = p.first, pj = p.second;
        REP(k,4){
            int ni = pi + di[k], nj = pj + dj[k];
            if(!isIn(ni,nj))continue;
            if(di[k]!=0 && cul[pi+max(0,di[k])][pj])continue;
            if(dj[k]!=0 && row[pi][pj+max(0,dj[k])])continue;
            if(d[ni][nj]!=IINF)continue;
            que.push({ni,nj});
            d[ni][nj] = d[pi][pj]+1;
        }
    }
    return (d[h-1][w-1]!=IINF?d[h-1][w-1]:0);
}

int main() {
    while(1){
        cin >> w >> h;
        if(w==0)break;
        REP(i,2*h-1){
            if(i%2==0){
                REP(j, w-1){
                    cin >> row[i/2][j+1];
                }
            }
            else{
                REP(j, w){
                    cin >> cul[i/2+1][j];
                }
            }
        }

        cout << bfs() << endl;
    }
    return 0;
}



Measured memory_bytes: 3120
use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::str::FromStr;
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")
}
fn main() {
    let n: usize = read();
    let a: Vec<i64> = (0..n).map(|_| read()).collect();
    let mut cnt: i64 = 0;
    for i in 0..n {
        if (i + 1) % 2 == 1 && a[i] % 2 == 1 {
            cnt += 1;
        }
    }
    println!("{}", cnt);
}


Measured memory_bytes: 2120
struct TreeDP<Lift, Merge, Init, Value, Edge> {
    size: usize,
    edge: Vec<(usize, usize, Edge)>,
    lift: Lift,
    merge: Merge,
    init: Init,
    phantom: std::marker::PhantomData<Value>,
}

impl<Lift, Merge, Init, Value, Edge>  TreeDP<Lift, Merge, Init, Value, Edge>
where Lift: Fn(Value, &Edge) -> Value,
      Merge: Fn(Value, Value) -> Value,
      Init: Fn(usize) -> Value,
{
    fn new(size: usize, lift: Lift, merge: Merge, init: Init) -> Self {
        TreeDP {
            size: size,
            edge: vec![],
            lift: lift,
            merge: merge,
            init: init,
            phantom: std::marker::PhantomData,
        }
    }
    fn add_edge(&mut self, a: usize, b: usize, c: Edge) {
        assert!(a < self.size && b < self.size && a != b);
        self.edge.push((a, b, c));
    }
    fn solve(&self, root: usize) -> Value {
        let size = self.size;
        let mut graph = vec![vec![]; size];
        for (i, e) in self.edge.iter().enumerate() {
            graph[e.0].push((e.1, i));
            graph[e.1].push((e.0, i));
        }
        let mut topo = vec![];
        let mut stack = vec![(root, root)];
        while let Some((v, p)) = stack.pop() {
            topo.push(v);
            if let Some(k) = graph[v].iter().position(|e| e.0 == p) {
                graph[v].remove(k);
            }
            for e in graph[v].iter() {
                stack.push((e.0, v));
            }
        }
        let mut dp: Vec<Option<Value>> = (0..size).map(|_| None).collect();
        for &v in topo.iter().rev() {
            let mut now = (self.init)(v);
            for &(u, k) in graph[v].iter() {
                let b = dp[u].take().unwrap();
                now = (self.merge)(now, (self.lift)(b, &self.edge[k].2));
            }
            dp[v] = Some(now);
        }
        dp[root].take().unwrap()
    }
}

use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    const MOD: u64 = 1_000_000_007;
    type Value = (u64, u64);
    type Edge = ();
    let lift = |a: Value, _e: &Edge| -> Value {
        a
    };
    let merge = |a: Value, b: Value| -> Value {
        (a.0 * (b.0 + b.1) % MOD, a.1 * b.0 % MOD)
    };
    let init = |_v: usize| -> Value {
        (1, 1)
    };
    let mut solver = TreeDP::new(n, lift, merge, init);
    for _ in 1..n {
        let x: usize = it.next().unwrap().parse::<usize>().unwrap() - 1;
        let y: usize = it.next().unwrap().parse::<usize>().unwrap() - 1;
        solver.add_edge(x, y, ());
    }
    let ans = solver.solve(0);
    println!("{}", (ans.0 + ans.1) % MOD);
}

fn main() {
    run();
}


Measured memory_bytes: 28920
S = list(input())
s = []
q = 0
ans = 0
for i in S:
    s.append(int(i))
for i in range(2 ** len(s)):
    for i2 in range(len(s)):
        if i >> i2 & 1:
            ans += q
            q = s[i2]
        else:
            q *= 10
    ans += q
    q = 0
print(ans)

Measured memory_bytes: 9192
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

ll x;

void run() {
	scanf("%lld",&x);
	ll ret=2*(x/11); x%=11;
	//printf("\t%lld %lld\n",ret,x);
	if(x>0) x-=6,++ret; if(x>0) x-=5,++ret;
	printf("%lld\n",ret);
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }

void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}


void solve() {
  int n;
  int p[2];
  cin >> n >> p[0] >> p[1];
  p[0]--; p[1]--;

  vector<vector<int> > g(n);
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    g[a].eb(b);
    g[b].eb(a);
  }

  /*
  青木くんとぶつからない, 一番遠い葉へ向かう
  */

  vector<vector<int> > table(2, vector<int>(n, inf));

  rep(key, 2) {
    queue<int> q;
    q.push(p[key]);
    table[key][p[key]] = 0;

    while (!q.empty()) {
      int now = q.front();
      q.pop();

      for (int nxt : g[now]) {
        if (chmin(table[key][nxt], table[key][now] + 1)) {
          q.push(nxt);
        }
      }
    }
  }

  int ma = -1;
  rep(i, n) if (table[0][i] < table[1][i] && chmax(ma, table[1][i])) {

  }
  cout << ma - 1 << endl;
  // 高橋くんが葉に逃げるタイミングではつかまらない

}


Measured memory_bytes: 7040
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		List<Integer> list = new ArrayList<Integer>();
		for(int i=0;i<n;i++)list.add(Integer.parseInt(sc.next()));
		sc.close();

		List<Integer> res = new ArrayList<Integer>();
		for (int i=n-1;i>=0;i--) {
			for (int j=i;j>=0;j--) {
				if (list.get(j)==j+1) {
					res.add(j+1);
					list.remove(j);
					break;
				}
			}
		}

		if (res.size()==n)for (int i=n-1;i>=0;i--)System.out.println(res.get(i));
		else System.out.println(-1);
	}
}

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

int main() {
	long long n, c = 1;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; ++i) cin >> a[i];
	vector<int> p(n, -1);
	p[0] = a[0];
	for(int i = 1; i < n; ++i){
		if(p[i - 1] >= a[i]){
			p[i] = a[i];
			c++;
		}
		else p[i] = p[i - 1];
	}
	cout << c;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, d; cin >> n >> d;
	d = 2 * d + 1;
	cout << (n + d - 1) / d << endl;
	return 0;
}

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

using namespace std;

int H, W, N;

int main(void) {

	cin >> H >> W >> N;
	int B;
	if (H >= W) { B = H; }
	else { B = W; }

	int ans = 0;
	int tot = 0;
	while (tot < N) {
		ans++;
		tot += B;
	}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 333, mod = 1000000007;
int f[maxn][maxn][maxn];
vector<pair<int,int>> rule[maxn];
int main(){
	int n, m; cin >> n >> m;
	for(int i = 0; i < m; i++){
		int l, r, x; cin >> l >> r >> x;
		rule[r].push_back({l, x});
	}
	auto upd = [&](int a, int b, int c, int d, int e, int g){
		f[a][b][c] += f[d][e][g];
		if(f[a][b][c] >= mod) f[a][b][c] -= mod;
	};
	int ans = 0;
	auto fwd = [&](int r, int g, int b){
		int k = max({r, g, b});
		bool bad = false;
		for(auto ru : rule[k]){
			int cnt = 0;
			if(r >= ru.first) cnt++;
			if(g >= ru.first) cnt++;
			if(b >= ru.first) cnt++;
			if(cnt != ru.second) bad = true;
		}
		if(bad) {
			f[r][g][b] = 0;
			return;
		}
		if(k == n) {
			ans += f[r][g][b];
			if(ans >= mod) ans -= mod;
			return;
		}
		upd(k + 1, g, b, r, g, b);
		upd(r, k + 1, b, r, g, b);
		upd(r, g, k + 1, r, g, b);
	};
	f[0][0][0] = 1;
	fwd(0, 0, 0);
	for(int i = 1; i <= n; i++){
		fwd(i, 0, 0);
		fwd(0, i, 0);
		fwd(0, 0, i);
		for(int j = 0; j < i; j++){
			for(int k = 0; k < j; k++){
				fwd(i, j, k);
				fwd(i, k, j);
				fwd(j, i, k);
				fwd(j, k, i);
				fwd(k, i, j);
				fwd(k, j, i);
			}
		}
	}
	cout << ans << endl;
	return 0;
}



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

using ll = long long;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SIZE(a) ((int)(a).size())

const int N = 105;

int n, a[2][N];
int f[2][N];

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

	cin >> n;
	REP(i, 2) REP(j, n) {
		cin >> a[i][j];
		f[i][j] = a[i][j] + max(i>0?f[i-1][j]:0, j>0?f[i][j-1]:0);
	}

	cout << f[1][n-1] << '\n';


	return 0;
}

Measured memory_bytes: 892
main(a,b,c,p,q,r,s,i){for(;scanf("%d%d%d",&a,&b,&c),a;){
if(!c)a==1&&b<0?printf("1 0 %d %d\n",a,b):printf("%d %d 1 0\n",a,b);
else{
	for(r=1;r*r<=a;r++)if(a%r==0)for(p=a/r,s=1;s<=abs(c);s++)if(c%s==0)for(i=0;i<2;i++,s=-s)if(q=c/s,p*s+q*r==b){
		if(p==r&&q<s)printf("%d %d %d %d\n",r,s,p,q);
		else printf("%d %d %d %d\n",p,q,r,s);
		goto next;
	}
	puts("Impossible");
}next:;}exit(0);}

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

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

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

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

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    int n,m,q;
    cin>>n>>m>>q;
    vector<vector<int>> sect(n);

    rep(i,m){
        int l,r;
        cin>>l>>r;
        --l;--r;
        sect[l].emplace_back(r);
    }
    rep(i,n)sort(all(sect[i]));

    rep(i,q){
        int pi,qi;
        cin>>pi>>qi;
        --pi;--qi;

        int qans=0;
        rep1(j,pi,qi+1)qans += upper_bound(all(sect[j]),qi)-sect[j].begin();

        cout<<qans<<endl;
    }

    //cout <<fixed<<setprecision(16)<< << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
const int INF=0x3f3f3f3f;
struct cmp1
{
    bool operator () (int &a, int &b)
    {
        return a > b ;
    }
};
int main()
{
    int n;
    int a[15],b[15];
    scanf("%d",&n);
    int l=1,k=0,s=1;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        l*=3;
        if(a[i]%2==0) k=2;
        else k=1;
        s*=k;
    }
    l-=s;
    cout<<l<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define pb push_back
#define int unsigned long long
 
int gcd(int a, int b){
	return b ? gcd(b, a % b) : a;
}
 
int lcm(int number1,int number2){
	int hoge=gcd(number1,number2);
	return number1 /hoge * number2;	
}
 
 
signed main(){
	int n;
	cin>>n;
	int a[n];
 
	for(int i=0;i<n;i++){
		a[i]=1;
	}
	// int a[n];
 
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int tmp=1;
	int ans=1;
	for(int i=0;i<n;i++){
		ans=lcm(a[i],ans);
 
		
	}
	cout<<ans<<endl;
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)(j);i <= (int)(k);i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
int sum[maxn];
const int mod=2019;
int cnt[3000];
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    string s;cin>>s;
    int len=s.length();
    len--;
    sum[len]=s[len]-'0';
    int bit=1;
    for(int i=len;i>=0;i--){
        sum[i]=(s[i]-'0')*bit%mod;
        sum[i]+=sum[i+1];
        sum[i]%=mod;
        bit*=10;bit%=mod;
    }
    cnt[0]++;
    int ans=0;
    for(int i=len;i>=0;i--){
        //debug(i),debug(sum[i]);
        ans+=cnt[sum[i]];
        cnt[sum[i]]++;
    }
    cout<<ans<<endl;
}
/* 
3*673

%2019?
 */

Measured memory_bytes: 4564
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using namespace __gnu_pbds;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"
#define  st first
#define  nd second
#define int long long

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef cc_hash_table<int, int, hash<int > > ht;

const int  M    =  1000000007;
const int  maxn =  100001   ;
const long long   inf  =  1e16     ;
const long double eps = 1.084202e-19;



int32_t main()
{
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      int te  ; 
     // cin >> te ; 
      te = 1 ; 
      while ( te-- ) {
        int n , m ; 
        cin >> n >> m ; 
        int a[n][m];
        for( int i = 0 ; i < n ; i ++){
            for( int j = 0 ; j < m ; j ++){
                char c ; 
                cin >> c ; 
                if(c=='#')
                   a[i][j]=1;
                else
                {
                    a[i][j]=0;
                }
                
            }
        }
        int dp[n][m];
        dp[0][0]=a[0][0];
        for(int i = 1 ; i < n ; i++){
            if(a[i-1][0] == a[i][0])
             dp[i][0] = dp[i-1][0];
            else{
                dp[i][0] = dp[i-1][0]+a[i][0];
            }
        }
        for(int j = 1 ; j < m ; j++){
            if(a[0][j-1]==a[0][j])
               dp[0][j] = dp[0][j-1];
            else{
            dp[0][j] = dp[0][j-1] + a[0][j];
            }
        }
        for(int i = 1 ; i < n ; i ++){
            for(int j = 1 ; j < m ; j++){
                int m1 , m2 ; 
                if(a[i][j] == a[i-1][j]){
                    m1 = dp[i-1][j];
                }
                else{
                    m1 = dp[i-1][j] + a[i][j];
                }
                if(a[i][j] == a[i][j-1]){
                    m2 = dp[i][j-1];
                }
                else{
                    m2 = dp[i][j-1] + a[i][j];
                }
                
                dp[i][j] = min(m1,m2);
            }
        }
        cout << dp[n-1][m-1] ;


      }


return 0;
}


Measured memory_bytes: 384
(let ((n (read))
    (AC 0)
    (WA 0)
    (TLE 0)
    (RE 0))
    (dotimes (i n)
        (case (read)
            (AC (incf AC))
            (WA (incf WA))
            (TLE (incf TLE))
            (RE (incf RE))
        )
    )
    (format t "AC x ~D~%WA x ~D~%TLE x ~D~%RE x ~D~%" AC WA TLE RE)
)

Measured memory_bytes: 76996
/****************************
/////  Shubham Singhal
/////  LNMIIT
*****************************/
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define lwr lower_bound
#define upr upper_bound
#define pq priority_queue
#define umap unordered_map
#define rep(i,n) for(i=0; i<n;i++)
#define repp(i,a,n) for(i=a; i<n;i++)
#define precise(x) cout<<fixed<<setprecision(x)
#define all(x) x.begin(),x.end()
#define lcm(a,b) (a*b)/__gcd(a,b)
#define prn(x) cout<<x<<"\n"
#define prn2(x, y) cout<<x<<" "<<y<<"\n"
#define prn3(x, y, z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define prn4(x, y, z, a) cout<<x<<" "<<y<<" "<<z<<" "<<a<<"\n"
#define prnv(x) for(auto i:x) cout<<i<<" "; cout<<"\n"
#define MOD 1000000007
#define MAX 300005
using namespace std;
 
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd; 
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;
const long long INF64 = 1'000'000'000'000'000'000ll;
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
void doc()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
}
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
}
int main()
{
	fast();
	int i,j,n;
	cin>>n;
	for(i=1;i<10;i++)
		for(j=1;j<10;j++)
			if(i*j==n)
			{
				cout<<"Yes";
				exit(0);
			}
		cout<<"No";
		
}

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

public class Main {

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

        int N = sc.nextInt();
        int K = sc.nextInt();

        int xxx = 0;
        int sum = 0;
        int ind = 0;
        int[] x = new int[N];

        for (int i = 0; i < N; i++) {
            x[i] = sc.nextInt();
            sum += x[i];
            if (i >= K) sum -= x[i - K];
            if (xxx < sum) {
                xxx = sum;
                ind = i;
            }
        }

        BigDecimal max = BigDecimal.ZERO;

        for (int i = ind - (K - 1); i <= ind; i++) {
            int p = x[i];
            int s = (int) ((0.5) * p * (p + 1));
            BigDecimal k = new BigDecimal(s).divide(new BigDecimal(p));
            max = max.add(k);
        }

        System.out.println(max);

        sc.close();
    }

}


Measured memory_bytes: 226484
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)
#define Pr(a) (#a)<<"="<<(a)<<" "
#define pr1(a) cerr<<Pr(a)<<endl
#define pr2(a,b) cerr<<Pr(a)<<Pr(b)<<endl
#define pr3(a,b,c) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<endl
#define pr4(a,b,c,d) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<endl
#define pr5(a,b,c,d,e) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<Pr(e)<<endl
#define pr6(a,b,c,d,e,f) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<Pr(e)<<Pr(f)<<endl
#define int long long
#define double long double
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef pair<int,int> P;
typedef long long ll;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}


signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);
  int n,q;
  cin>>n>>q;
  vector<stack<int> > S(n);
  
  while(q--){
    int cmd;
    cin>>cmd;
    
    if(cmd == 0){
      int t, x;
      cin>>t>>x;
      S[t].push(x);
    }
    if(cmd == 1){
      int t;
      cin>>t;
      if(!S[t].empty()) cout<<S[t].top()<<endl;
    }
    
    if(cmd == 2){
      int t;
      cin>>t;
      if(!S[t].empty()) S[t].pop();
    }
  }


  
  return 0;
}



Measured memory_bytes: 5016
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <math.h>
using namespace std;
typedef long long int ll;


int main(){
	while(1){
		string s; cin >> s;
		if(s=="#")break;
		int n=s.size();
		bool ok=false;
		for(int i=0;i<n;i++){
			if(s[i]=='('){
				i++;
				set<char> a,b;
				while(s[i]!=')'){
					if(s[i]=='~'){
						i++;
						b.insert(s[i]);
						i++;
					}
					else if(s[i]=='&')i++;
					else{
						a.insert(s[i]);
						i++;
					}
				}
				bool che=true;
				for(auto p:a){
					if(b.find(p)!=b.end()){
						che=false;
						break;
					}
				}
				ok=che;
			}
			if(ok)break;
		}
		if(ok){
			cout << "yes" << endl;
		}
		else{
			cout << "no" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3140
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VVI;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
 
int main(){
  string S,T;
  int A,B;
  string U;
  cin>>S>>T>>A>>B>>U;
  if(U==S) A=max(0,A-1);
  else B=max(0,B-1);
  cout<<A<<" "<<B<<endl;
}

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

#define forr(i,a,b) for(int i = a; i < int(b); i++)
#define forn(i, n)  forr(i, 0, n)
#define pb push_back
#define fst first
#define snd second


using namespace std;

typedef long long ll;

const int MAXN = 1<<20;

int N, Ans;
int A[MAXN];
bool U[MAXN];

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

	cin>>N;
	forn(i, N) cin>>A[i];

	sort(A, A+N);

	for(int p = 30; p >= 0; --p ){
		int i = 0, j = N-1;
		while( i < j ){
			if( U[i] or A[i] + A[j] < (1<<p) ) ++i;
			else
			if( U[j] or A[i] + A[j] > (1<<p) ) --j;
			else{
				++Ans;
				U[i] = U[j] = true;
			}
		}
	}
	cout << Ans << endl;

	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set

using namespace std;

const ll MOD = 1000000007;

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

  string a = "";
  for (ll i = 0; i < s.size(); i++) {
    a += "x";
  }
  cout << a << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		int N = Integer.parseInt(W) +1;
		long[] A = new long[N];
		long[] B = new long[N];


		W = in.readLine();
		String[] Ws = W.split(" ");
		for(int i=0;i<N;i++){
			A[i] = Long.parseLong(Ws[i]);
		}

		W = in.readLine();
		Ws = W.split(" ");
		for(int i=0;i<N-1;i++){
			B[i] = Long.parseLong(Ws[i]);
		}
		B[N-1]=0;

		long destory=0;
		long diff=0;
		for(int i=0;i<N;i++){
			//A[i-1]の勇者が何体倒せるか
			if(diff >= A[i]){
				//全部倒せるなら戦力を次に残す
				diff=B[i];
				destory+=A[i];
			}else{
				//倒せない場合は残りをA[i]で倒す
				long remain = A[i] -diff;
				destory+=diff;
				//A[i]の戦力ですべて倒せるか
				if(remain <= B[i]){
					//倒せる場合は次に残す戦力を計算する
					diff=B[i]-remain;
					destory+=remain;
				}else{
					//倒せない場合は倒せる数だけ倒す
					diff=0;
					destory+=B[i];

				}
			}
		}
		System.out.println(destory);


	}

}


Measured memory_bytes: 61176
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
//#include <utility>
#include <set>
#include <iostream>
//#include <memory>
#include <string>
#include <vector>
#include <algorithm>
//#include <functional>
#include <sstream>
//#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
//#include <cctype>
#include <cstring>
//#include <ctime>
#include <iterator>
#include <bitset>
//#include <numeric>
//#include <list>
//#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


namespace{
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;

vint v;
vint dp;
int n;
void mainmain(){
	// int n;
	cin>>n;
	// uf.init();
	v=vint(n);
	rep(i,n) cin>>v[i];
	dp=vint(n,-1);
	priority_queue<pii> pq;
	pq.push(mkp(0,0));
	while(!pq.empty()){
		pii top=pq.top();
		pq.pop();
		if(dp[top.S]!=-1) continue;
		dp[top.S]=-top.F;
		// cout<<top.S<<" "<<-top.F<<endl;
		if(v[top.S]==0){
			rep(i,6){
				pq.push(mkp(top.F-1,top.S+i+1));
			}
		}
		else{
			pq.push(mkp(top.F,top.S+v[top.S]));
		}
	}
	cout<<dp[n-1]<<endl;
}



}
main() try{
    mainmain();
}
catch(...){
}

Measured memory_bytes: 1792