akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long int
using namespace std;
 
signed main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
    //cout<<"I must do it...Yeahhh";
    
    int t=1;
    //cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int sum=0;
        for(int i=1;i<=n;i++)
        {
            if(i%3==0)
            {}
            else if(i%5==0)
            {}
            else
                sum+=i;
        }
        cout<<sum;
    }
    //cerr<<"[Execution : "<<(1.0*clock())/CLOCKS_PER_SEC<<"s]\n";
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define REP(asd, fgh) for(int asd = 0; asd < fgh; asd++)

int n;

class Node{
  public:
  int p;
  int depth;
  int height;
  int sibling;
  int degree;
  string type;
};

vector<Node> ans;
vector< vector<int> > t;

int dfs(int ind, int prev, int depth){
  ans[ind].p = prev;
  ans[ind].depth = depth;
  if(t[ind].size() == 0 && ans[ind].type != "root"){
    ans[ind].type = "leaf";
    ans[ind].height = 0;
    return 1;
  }
  int height = 0;
  for(int i = 0; i < t[ind].size(); i++){
    height = max(height, dfs(t[ind][i], ind, depth+1));
  }
  ans[ind].height = height;
  return height + 1;
}

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

  cin >> n;
  ans = vector<Node>(n);
  t = vector< vector<int> >(n, vector<int>(0));
  int root;
  REP(i, n){
    int id; cin >> id;
    ans[id].type = "internal node";
    REP(j, 2){
      int c; cin >> c;
      if(c == -1) continue;
      t[id].push_back(c);
    }
    ans[id].degree = t[id].size();
    if(ans[id].degree == 1){
      ans[ t[id][0] ].sibling = -1;
    }else if(ans[id].degree == 2){
      ans[ t[id][0] ].sibling = t[id][1];
      ans[ t[id][1] ].sibling = t[id][0];
    }
  }
  //ans[0].p = -1;
  //ans[0].depth = 0;
  vector<bool> used(n, false);
  for(int i = 0; i < n; i++){
    for(int j = 0; j < t[i].size(); j++){
      used[ t[i][j] ] = true;
    }
  }
  for(int i = 0; i < n; i++){
    if(used[i] == false){
      root = i;
      break;
    }
  }
  ans[root].type = "root";
  dfs(root, -1, 0);
  ans[root].sibling = -1;

  for(int i = 0; i < n; i++){
    cout << "node " << i << ": parent = " << ans[i].p << ", sibling = " << ans[i].sibling << ", degree = " << ans[i].degree << ", depth = " << ans[i].depth << ", height = " << ans[i].height << ", " << ans[i].type << endl;
  }

  return 0;
}

Measured memory_bytes: 1240
n,a,b = map(int,input().split())
mod = pow(10,9)+7
ans = pow(2,n,mod) - 1
anu = 1
ade = 1
bnu = 1
bde = 1
for i in range(max(a,b)):
  if i < a:
    anu = (anu*(n-i))%mod
    ade = (ade*(a-i))%mod
  if i < b:
    bnu = (bnu*(n-i))%mod
    bde = (bde*(b-i))%mod
ade = pow(ade,mod-2,mod)
bde = pow(bde,mod-2,mod)
ans -= (anu*ade)%mod
ans -= (bnu*bde)%mod
print(ans%mod)

Measured memory_bytes: 3064
n,m=list(map(int,input().split()))
count={}
for i in range(n):
  count[i+1]=0
for i in range(m):
  a1,b1=[int(j) for j in input().split()]
  count[a1]=count[a1]+1
  count[b1]=count[b1]+1
for i in range(n):
  print(count[i+1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define ld long double
#define pll pair<ll, ll>
#define pii pair<int, int>
#define f first
#define se second
#define pb push_back
#define ft fflush(stdout)
 
 
using namespace std;
 
 
const int N = 2e5 + 123;
const int PLS = 3e5 + 123;
const int mod = 1e9 + 7;
const ll inf = 1e16;


ll n, a[N], c[N], b[N], dp[N][3];


int main() {
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL); cout.tie(NULL);
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i] >> b[i] >> c[i];
    dp[1][0] = a[1];
    dp[1][1] = b[1];
    dp[1][2] = c[1];
    for (int i = 2; i <= n; i++) {
        dp[i][0] = a[i] + max(dp[i - 1][1], dp[i - 1][2]);
        dp[i][1] = b[i] + max(dp[i - 1][0], dp[i - 1][2]);
        dp[i][2] = c[i] + max(dp[i - 1][1], dp[i - 1][0]);
    }
    cout << max(dp[n][0], max(dp[n][1], dp[n][2]));
}

Measured memory_bytes: 8960
#include<stdio.h>
int main(void){
	int x,s;
	scanf("%d",&x);
	while(x>=500){
		x-=500;
		s+=1000;
	}
	while(x>=5){
		x-=5;
		s+=5;
	}
	printf("%d",s);
	return 0;
}

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

#define int long long
#define endl '\n'

struct dsu {
    int connected;
    vector<int> par, siz;

    dsu(int n) {
        init(n);
    }

    void init(int n) {
        connected = n;
        par.resize(n + 1);
        siz.resize(n + 1);
        for (int i = 1; i <= n; i++) {   
            par[i] = i;
            siz[i] = 1;
        }
    }

    int find(int x) {
        return par[x] = (par[x] == x) ? x : find(par[x]);
    }

    int size(int x) {
        return siz[find(x)];
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }

    void merge(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y)  return;
        connected--;
        if (siz[x] < siz[y])   swap(x, y);
        par[y] = x;
        siz[x] += siz[y];
        siz[y] = 0;
    }
};

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int n, m; cin >> n >> m;
    vector<int> adj[m + 1];
    for (int i = 1; i <= n; i++) {
        int x; cin >> x;
        for (int j = 0; j < x; j++) {
            int l; cin >> l;
            adj[l].push_back(i);
        }
    }
    dsu d(n);
    for (int i = 1; i <= m; i++) {
        for (int j = 1; j < (int)adj[i].size(); j++)
            d.merge(adj[i][j], adj[i][j - 1]);
    }
    cout << (d.connected == 1 ? "YES" : "NO");
}

Measured memory_bytes: 5120
import itertools

def main():
    n, m, q = map(int, input().split())
    r = list(map(int, input().split()))
    dist = [[10**18 for _ in range(n)] for _ in range(n)]
    for i in range(m):
        a, b, c = map(int, input().split())
        dist[a-1][b-1] = c
        dist[b-1][a-1] = c

    for k in range(n):
        for i in range(n):
            for j in range(n):
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

    ans = 10 ** 18
    for p in itertools.permutations(r):
        total = 0
        for i in range(q-1):
            total += dist[p[i]-1][p[i+1]-1]
        ans = min(ans, total)

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 47192
S=input()
n=len(S)
if n%2:
    m=n//2
    t=S[m]
    for i in range(m):
        if S[m+i+1]!=t or S[m-i-1]!=t:
            a=m+i+1
            break
    else:
        a=n
else:
    m=n//2
    t=S[m]
    for i in range(m):
        if S[m+i]!=t or S[m-i-1]!=t:
            a=m+i
            break
    else:
        a=n
print(a)

Measured memory_bytes: 3188
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	void run(){
		int[] a=new int[51];
		Arrays.fill(a, INF);
		for(int k=0; toGramme(0, 0, k)<=50; k++){
			for(int j=0; toGramme(0, j, k)<=50; j++){
				for(int i=0; toGramme(i, j, k)<=50; i++){
					int g=toGramme(i, j, k);
					a[g]=Math.min(a[g], toMoney(i, j, k));
				}
			}
		}
		for(;;){
			int g=sc.nextInt()/100;
			if(g==0){
				break;
			}
			println(a[g]+"");
		}
	}

	int toGramme(int i, int j, int k){
		return i*2+j*3+k*5;
	}

	int toMoney(int i, int j, int k){
		int sum=0;
		sum+=380*(i-i%5)*80/100+380*(i%5);
		sum+=550*(j-j%4)*85/100+550*(j%4);
		sum+=850*(k-k%3)*88/100+850*(k%3);
		return sum;
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 12000
process.stdin.resume();
process.stdin.setEncoding('utf8');
 
// inputに入力データ全体が入る
function Main(input) {
  // 1行目がline1, 2行目がline2, …に入る
  var tmp = input.split("\n");
  var line0 = tmp[0].split(" ");
  //var line1 = tmp[1].split(" ");
  //var line2 = tmp[2].split(" ");
  //var line3 = tmp[3].split(" ");

  var a = Number(line0[0]);
  var b = Number(line0[1]);
  var ans = 0;

  //console.log(a +" "+ b +" "+ "hoge")

  ans = (a + b) % 24;


  console.log(ans);


}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21320
use std::io::Write;

macro_rules! eprintln {
    ($($args:tt)*) => { let _ = writeln!(&mut std::io::stderr(), $($args)*); }
}

fn read_line() -> Vec<String> {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).expect("Failed to read line");
    line.trim().split_whitespace().map(|s| s.to_string()).collect()
}

struct Reader { v: Vec<String>, n: usize }

impl Reader {
    fn new() -> Self { Reader { v: read_line(), n: 0 } }
    fn next<T>(&mut self) -> T where T: std::str::FromStr, T::Err: std::fmt::Debug {
        if self.n == self.v.len() { self.v = read_line(); self.n = 0; }
        self.n += 1;
        self.v[self.n-1].parse().expect(&self.v[self.n-1])
    }
    #[allow(dead_code)]
    fn nexts<T>(&mut self, n: usize) -> Vec<T>
    where T: std::str::FromStr, T::Err: std::fmt::Debug {
        let mut v = Vec::with_capacity(n);
        for _ in 0..n { v.push(self.next()); }
        v
    }
}

fn main() {
    let mut r = Reader::new();
    let s: String = r.next();

    let mut ans = 0;
    for i in 0..(s.len()/2) {
        if s.as_bytes()[i] != s.as_bytes()[s.len()-i-1] {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.util.*;

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

        int[] a = new int[N];
        Map<Integer, Integer> valuesToCount = new HashMap<>();
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
        }

        for (int i = 0; i < N; i++) {
            int value = a[i];
            if (valuesToCount.containsKey(value)) {
                valuesToCount.put(value, valuesToCount.get(value) + 1);
            } else {
                valuesToCount.put(value, 1);
            }
        }

        int ans = 0;
        for (Map.Entry<Integer, Integer> entry: valuesToCount.entrySet()) {
            int count = entry.getValue();
            int value = entry.getKey();
            if (count > value) {
                ans += count - value;
            } else if (value > count) {
                ans += count;
            }
        }

        System.out.println(ans);
    }
}

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

int main(){
    LL N;
    cin >> N;
    
    int f = 10;

    for(LL A=1; A*A<=N; A++){

        if(N%A != 0) continue;

        LL a = A;
        LL b = N/A;
        int B_d = 0;
        int A_d = 0;

        while(a>0){
            a /= 10;
            A_d++;
        }

        while(b>0){
            b /= 10;
            B_d++;
        }

        f = min(f,max(A_d,B_d));
    }

    cout << f << endl;

}

Measured memory_bytes: 3652
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 5e3 + 10;

ll dp[4][N * N];
int c[2][4], wt[4], val[4];

ll knapsack(int n, int w);

int main() {
	fast_cin();
	ll n; cin >> n;
	for (int i = 0; i < 2; ++i) {
		for (int j = 1; j <= 3; ++j) {
			cin >> c[i][j];
		}
	}
	for (int j = 1; j <= 3; ++j) {
		wt[j] = c[0][j];
		val[j] = c[1][j] - c[0][j];
	}
	n += knapsack(3, n);
	for (int j = 1; j <= 3; ++j) {
		wt[j] = c[1][j];
		val[j] = c[0][j] - c[1][j];
	}
	n += knapsack(3, n);
	cout << n << endl;
}

ll knapsack(int n, int w) {
	memset(dp, 0, sizeof(dp));
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j <= w; ++j) {
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
			if (j + wt[i + 1] <= w) {
				dp[i][j + wt[i + 1]] = max(dp[i][j + wt[i + 1]], dp[i][j] + val[i + 1]);
			}
		}
	}
	ll ans = 0;
	for (int j = 0; j <= w; ++j) {
		ans = max(ans, dp[n][j]);
	}
	return ans;
}

Measured memory_bytes: 784640
from collections import deque

s = deque(input())
q = int(input())
flg = 0

for _ in range(q):
  Q = [x for x in input().split()]
  if Q[0] == '1':
    flg += 1
  else:
    if (Q[1] == '1' and flg%2==0) or (Q[1] == '2' and flg%2==1):
      s.appendleft(Q[2])
    else:
      s.append(Q[2])
if flg%2==1:
  s.reverse()

print('' . join(s))

Measured memory_bytes: 8436
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){
	string s;cin>>s;
	int ans = 10000;
	for(int i=0;i+3<=s.length();i++){
		ans = min(ans,abs(stoi(s.substr(i,3))-753LL));
	}
	cout<<ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Roc ios_base::sync_with_stdio(false), cin.tie(NULL)
#define ll long long
#define NMAX 100009

using namespace std;
const ll inf = 1e9 + 5;
ll n, G, w[NMAX], p[NMAX], pd[NMAX];
int main()
{
    Roc;
    cin >> n >> G;
    ll pret = 0;
    for(ll i = 1; i <= n; ++i)
        {
            cin >> w[i] >> p[i];
            pret += p[ i ];
        }
    for(int i = 1 ; i <= pret ; ++i)
        pd[ i ] = inf;
    for(ll i = 1; i <= n; ++i)
        for(ll j = pret - p[i]; j >= 0; --j)
            if(pd[j] != inf)
                pd[j + p[i]] = min(pd[j + p[i]], pd[j] + w[i]);
    for(int i = pret; i >= 0 ; -- i)
        if(pd[i] <= G)
        {
            cout << i;
            return 0;
        }
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double pi=3.14159265358979323846;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
int main(){
    int n,m;cin>>n>>m;
    if(n==m)out("Yes");
    else out("No");
}

Measured memory_bytes: 764
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int r = Integer.parseInt(in.next());
            int ans = 0;
            if (n >= 10) ans = r;
            else ans = r + 100 * (10 - n);

            // 出力
            out.println(ans);

        }

    }
}



Measured memory_bytes: 21588
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;


int main() {
    int n; cin >> n;
    vector<int> vx(n), vy(n);
    vector<ll> vh(n);

    int si = -1;
    for (int i = 0; i < n; ++i) {
        cin >> vx[i] >> vy[i] >> vh[i];
        if (vh[i] > 0) si = i;
    }

    ll resx = -1, resy = -1, resh = -1;    
    for (ll x = 0; x <= 100; ++x) {
        for (ll y =0; y <= 100; ++y) {
            ll h = vh[si] + abs(x - vx[si]) + abs(y - vy[si]);
            bool ok = true;
            for (int i = 0; i < n; ++i) {
                if (vh[i] > 0 && h - vh[i] != abs(x - vx[i]) + abs(y - vy[i])) ok = false;
                if (vh[i] == 0 && h > abs(x - vx[i]) + abs(y - vy[i])) ok = false;
            } 
        if (ok) resx = x, resy = y, resh = h;
        }
    }
    cout << resx << " " << resy << " " << resh << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long a = sc.nextLong();
    long b = sc.nextLong();
    
    long ans = 0;
    if((b-a)%2 == 0){
      ans = (b-a)/2;
    }else{
      long x = a + ((b-a)-1)/2;
      long y = (N-b+1) + (N-(a+(N-b+1)))/2;
      ans = Math.min(x, y);
    }
    System.out.println(ans);
  }
}

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

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

using namespace  std;

typedef long long ll;

ll w;

string rec(ll sum,ll pow3,int cnt) {
  if( sum == w ) return "";
  if( cnt >= 12 ) return "X";

  // +
  string tmp = rec(sum+pow3,pow3*3LL,cnt+1);
  if( tmp != "X" ) return tmp + "+";
  
  // 0
  tmp = rec(sum,pow3*3LL,cnt+1);
  if( tmp != "X" ) return tmp + "0";

  // -
  tmp = rec(sum-pow3,pow3*3LL,cnt+1);
  if( tmp != "X" ) return tmp + "-";

  return "X";
}

int main(){
  cin >> w;
  cout << rec(0LL,1LL,0) << endl;
  return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
#define maxn 100001
#define maxa 1000005
#define MOD 1000000007
#define INF 1000000000000000000

using namespace std;

#define ll long long
#define pii pair<ll, ll>
#define piii pair<pii, ll>
#define ft first
#define sd second
#define rep(i, a, n) for(ll i = a; i < n; i++)
#define repr(i, a, n) for(ll i = n-1; i >= a; i--)
#define meme(a, b) memset(a, b, sizeof(a))

void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}
ll ceil(ll a, ll b){if((a%b) != 0) return a/b+1; return a/b;}
void flaged(bool flag){
    if(flag) cout << "Yes\n";
    else cout << "No\n";
}
ll power(ll a, ll b = MOD-2){
    if(b == 0) return 1;
    ll r = power(a, b/2);
    r = (r*r)%MOD;
    if(b%2 == 1) r = (r*a)%MOD;
    return r;
}

void solve(){
    ll x, y; string a, b, c;
    cin >> a ;
    for(ll i = 0;  i < a.size(); i++) b += 'x';
    cout << b;
 }

int main()
{
    fast();
    ll t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256
/********************/
/* Author: eddysboy */
/* Time: 2019-02-23 */
/********************/
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cstdio>
#define int long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int n;
int a;
int ans;
signed main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a,ans=__gcd(ans,a);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
s=[int(_) for _ in input()]

m = [0 for i in range(2019)]

d=0
m[d]+=1
p=1
for i in range(len(s)):
  d=(d+s[-i-1]*p)%2019
  m[d]+=1
  p=(p*10)%2019
  #print(d)


ans=0  
for i in range(2019):
  ans+=m[i]*(m[i]-1)//2
  
print(ans)

Measured memory_bytes: 10704
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""


N,M,K = m()
po = []
for i in range(N):
    po.append(l())

ans = Max

for i in range(2**N):
    kane = 0
    un = [0 for _ in range(M)]
    no = i
    for j in range(N):
        ppp = no % 2
        if ppp:
            for k in range(M+1):
                if k == 0:
                    kane += po[j][k]
                else:
                    un[k-1] += po[j][k]
        no //=2
    if all(map(lambda x:x >= K,un)):
        ans = min(ans,kane)
if ans != Max:
    print(ans)
else:
    print(-1)


Measured memory_bytes: 68996
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int p,q,r;
	cin>>p>>q>>r;
	cout<<p+q+r-max({p,q,r})<<endl;
}


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

//関数
    
    
    
    
//main関数
int main() {
    
    
    
    //入力
    string S;
    cin>>S;
    
    
    
    
    
    
    
    
    
    
    //計算
    long sum=0,b=0;
    for(int i=0;i<S.size();i++){
        if(S.at(i)=='B'){
            b++;
        }else{
            sum+=b;
        }
    }
    
    
    
    
    
    
    
    
    
    
    //出力
    cout <<sum<<endl;
}

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

int main() {
    int n; std::cin >> n;
    std::vector<int> price(n);
    for (size_t i = 0; i < n; ++i) std::cin >> price[i];
    
    int expensive = *std::max_element(price.begin(), price.end());
    int total = std::accumulate(price.begin(), price.end(), 0) - (expensive / 2);

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;
const int MOD = 1000000007;

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

  REP(i, 2, n){
    int num = i;
    REP(j, 2, n){
      while(num % j == 0){
        a[j]++;
        num /= j;
      }
    }
  }

  ll ans = 1;
  REP(i, 2, n){
    ans *= a[i] + 1;
    ans %= MOD;
  }

  cout << ans << endl;

  return 0;
}


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

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

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

    // 0で初期化
    int num[110] = {0};

    // バケット
    for(int i = 0; i < N; i++) {
        num[d[i]]++;
    }

    int count = 0;
    for(int i = 0; i < 110; i++) {
        if(num[i]) {
            count++;
        }
    }

    cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#define ff(i,x,y)for(int i=x;i<y+1;i++)
#define fs(i,x,y)for(int i=x;i>y-1;i--)
#define all(x) x.begin(),x.end()
#define Ins(x) inserter(x,x.begin())
//set<int>::iterator it
using namespace std;
typedef long long ll;
ll n,m,ans;
int main()
{
    cin>>n>>m;
    if(n==1&&m==1)
        ans=1;
    else if(n==1) ans=m-2;
    else if(m==1) ans=n-2;
    else if(n==2) ;
    else if(m==2) ;
    else ans=(n-2)*(m-2);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
int n;
int lowbit(int x){
	return (x) &(-x);
}
int main(){
	scanf("%d",&n);
	int t=__builtin_popcount(n);
	if (t==1){
		puts("No");
		return 0;
	} 
	puts("Yes\n1 3\n3 2");
	printf("2 %d\n",1+n);
	printf("%d %d\n",1+n,3+n);
	printf("%d %d\n",n+2,n+3);
	for (int i=4;i<=((n-1)/2)*2+1;i+=2){
		printf("%d 1\n",i+1);
		printf("%d 1\n",i);
		printf("%d %d\n",i,i+1+n);
		printf("%d %d\n",i+n,i+1);
	}
	if (n%2==0){
		int x=lowbit(n),y=n^x;
		printf("%d %d\n",y,n);
		printf("%d %d\n",n+n,x+1);
	}
}

Measured memory_bytes: 2304
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int a,b,c,d,e;
	while(scanf("%d,%d,%d,%d,%d",&a,&b,&c,&d,&e)!=EOF)
	{
		int cards[13]={0};
		int dbl=0,thr=0,four=0,straight=0,tmp=0;
		cards[a-1]++; cards[b-1]++; cards[c-1]++; cards[d-1]++; cards[e-1]++;

		for(int i = 0; i < 13; ++i)
		{
			if(cards[i]==2) dbl++;
			else if(cards[i]==3) thr++;
			else if(cards[i]==4) four++;

			if(0<i&&cards[i]==1&&cards[i-1]==1) tmp++;
			straight=max(tmp,straight);
		}

		if(four) cout<<"four card"<<endl;
		else if(thr&&dbl) cout<<"full house"<<endl;
		else if(straight==4||cards[0]==1&&cards[9]==1&&cards[10]==1&&cards[11]==1&&cards[12]==1) cout<<"straight"<<endl;
		else if(thr) cout<<"three card"<<endl;
		else if(dbl==2) cout<<"two pair"<<endl;
		else if(dbl) cout<<"one pair"<<endl;
		else cout<<"null"<<endl;
	}
  return 0;
}

Measured memory_bytes: 1200
#include <stdio.h>
#include<math.h>

int main (void)
{
	int kazu;
	double ten[1000];
	int i;
	double wa,m,a,at;
	double an;

	while(1)
	{
		scanf("%d",&kazu);

		if(kazu==0) break;

		
		for(i=0;i<1000;i++)
		{
			ten[i]==0;
		}

		for(i=0;i<kazu;i++)
		{
			scanf("%lf",&ten[i]);
		}

		wa = 0;
		for(i=0;i<kazu;i++)
		{
			wa=wa+ten[i];
		}

		m = wa / kazu;

		a=0;
		for(i=0;i<kazu;i++)
		{
			a= a+(ten[i]-m)*(ten[i]-m);
		}

		at = a / kazu;

		an=sqrt(at);

		printf("%.8f\n",an);

	}

		return 0;
}	

Measured memory_bytes: 668
#include<bits/stdc++.h>
using namespace std;
int main(){
	int d,n;
  cin>>d>>n;
  if(d==0 && n!=100)cout<<n;
  else if(d==0 && n==100) cout<<101;
  else if(d==1 && n!=100)cout<<100*n;
  else if(d==1 && n==100)cout<<100*101;
  else if(d==2 && n!=100)cout<<100*100*n;
  else cout<<100*100*101;
}

Measured memory_bytes: 3620
// template {{{
#include <bits/stdc++.h>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define sz(c) (static_cast<int>(c.size()))
#define endl "\n"

using ld = long double;
using ll = long long;

inline ll addm(ll __a, ll __b, ll __m);
inline ll subm(ll __a, ll __b, ll __m);
inline ll mulm(ll __a, ll __b, ll __m);
ll powm(ll __a, ll __b, ll __m);
ll inv(ll __x, ll __m);
// }}}

const ll INFL = numeric_limits<ll>::max() / 2;
const ll INF = numeric_limits<int>::max() / 2;
const ll MOD = 1e9+7;

const int N = 3005;
ll a[N], mem[N][N][2];
bool vis[N][N][2];
ll dp(int l, int r, int t)
{
    if (l > r) return 0;
    ll &ret = mem[l][r][t];
    if (vis[l][r][t]) return ret;
    vis[l][r][t] = true;
    return ret = (!t) ? max(dp(l+1, r, !t) + a[l], dp(l, r-1, !t) + a[r])
        : min(dp(l+1, r, !t) - a[l], dp(l, r-1, !t) - a[r]);
}

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

// main {{{
int main()
{
    cin.sync_with_stdio(0); cin.tie(NULL);
    solve();
    return 0;
}

inline ll addm(ll __a, ll __b, ll __m = MOD) {
    return ((__a+__b)%__m);
}
inline ll subm(ll __a, ll __b, ll __m = MOD) {
    return (((__a-__b)%__m+__m)%__m);
}
inline ll mulm(ll __a, ll __b, ll __m = MOD) {
    return ((__a*__b)%__m);
}
ll powm(ll __a, ll __b, ll __m = MOD) {
    ll ret = (!__b) ? 1 : powm(__a, __b/2, __m);
    return (!__b) ? 1 : mulm(mulm(ret, ret, __m), (__b%2) ? __a : 1, __m);
}
ll inv(ll __x, ll __m = MOD) {
    return powm(__x, __m-2, __m);
}
// }}}


Measured memory_bytes: 158336
n, m = map(int, input().split())
h = [int(x) for x in input().split()]
observary = [[] for _ in range(n)]
for i in range(m):
    a, b = map(lambda x: int(x) - 1, input().split())
    observary[a].append(h[b])
    observary[b].append(h[a])
    
ans = 0
for i in range(n):
    if len(observary[i]) == 0:
        ans += 1
    elif max(observary[i]) < h[i]:
        ans += 1

print(ans)

Measured memory_bytes: 22912
def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    a_list.sort()
    flag = True

    for i in range(n - 1):
        if a_list[i] == a_list[i + 1]:
            flag = False
            break

    if flag:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    main()


Measured memory_bytes: 93768
#include "bits/stdc++.h"

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x;
    cin>>x;
    if(x<1200) print("ABC");
    else print("ARC");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i++; i<N)
#define RVROOP(i, N) for(int i=N; i--; i>=0)
#define ALL(v) v.begin(), v.end()
const int INF = 1e9;
const int MAX = 510000;
const int MOD = 1000000007;
using namespace std;
typedef long long ll;

int main() {
  int N; cin>>N;
  vector<int> P(N);
  for(int i=0; i<N; i++){
    cin>>P[i];
  }
  
  int m=P[0];
  
  int ans=0;
  
  for(int i=0; i<N; i++){
    if(P[i]<=m){
      ans++;
    }
    m=min(P[i], m);
  }
  
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 1024
coin=[int(input()) for i in range(3)]
x=int(input())
c=0
for i in range(coin[0]+1):
    if 500*i>x:break
    else:
        for j in range(coin[1]+1):
            if 500*i+100*j>x:break
            else:
                for k in range(coin[2]+1):
                    t=500*i+100*j+k*50
                    if t>x:break
                    elif t==x:c+=1
print(c)

Measured memory_bytes: 3316
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
inline bool read(ll &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
int main(){
char c[110][110];
int h=read(),w=read(),i,j;
for (i=1;i<=h;++i) scanf("%s",c[i]+1);
for (i=1;i<=h*2;i++,pl){
  for (j=1;j<=w;++j){
    pc(c[(i+1)/2][j]);
    }
  }
}

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

int main()
{
	int a, b, c, d, e, f;
	double kotaemin, min;
	while (cin >> a >> b >> c >> d >> e >> f) {
		double y,x;
		kotaemin = (a*f) - (c*d);
		min = a*e - b*d;
		y = kotaemin / min;
		x = (c - b*y) / a;
	//	y += 0.0005;
		//x += 0.0005;
		printf("%.3f %.3f\n",  x, y);
	}

	return 0;
}

Measured memory_bytes: 3116
from collections import Counter

N = int(input())
a = [int(x) // 400 for x in input().split()]

c = Counter(a)

cnt1, cnt2 = 0, 0
for k, v in c.items():
    if k < 8:
        cnt1 += 1
    else:
        cnt2 += v

if cnt1 == 0:
    print(1, cnt2)
else:
    print(cnt1, cnt1 + cnt2)


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define at(x,i) get<i>(x);
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    while(true){
    ll h,w;cin >> w >>h;
    if(w==0&&h==0)break;
    vvl lr(h,vl(w-1)),ud(h-1,vl(w));
    rep(i,2*h-1){
        if(i%2==0){
            rep(j,w-1)cin >> lr[i/2][j];
        }
        else{
            rep(j,w)cin >> ud[(i-1)/2][j];
        }
    }
    queue<pl> que;
    que.push(mp(0,0));
    vvl dist(h,vl(w,0));
    dist[0][0]=1;
    while(!que.empty()){
        pl v=que.front();
        que.pop();
        rep(i,4){
            ll ny=v.fi+dy[i],nx=v.se+dx[i];
            if(ny<0||nx<0||ny>=h||nx>=w)continue;
            if(dist[ny][nx]!=0)continue;
            if(i==0&&ud[v.fi][nx]==1)continue;
            if(i==1&&lr[ny][nx]==1)continue;
            if(i==2&&ud[ny][nx]==1)continue;
            if(i==3&&lr[ny][v.se]==1)continue;
            dist[ny][nx]=dist[v.fi][v.se]+1;
            que.push(mp(ny,nx));
        }
    }
    cout << dist[h-1][w-1] <<endl;
    }
}


Measured memory_bytes: 3160
LIMIT = 2 * 10**5
is_prime = [True] * LIMIT
is_prime[0] = False
is_prime[1] = False
primes = []
for i in range(LIMIT):
    if is_prime[i]:
        primes.append(i)
        for j in range(i*2, LIMIT, i):
            is_prime[j] = False

def solve(x):
    for i in range(len(primes)):
        if primes[i] >= x:
            return primes[i]
    return -1

x = int(input())
print(solve(x))

Measured memory_bytes: 5296
#include<bits/stdc++.h>
using namespace std;
int n,k;
double a[200100],lmax,b,c,p[200100];
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{cin>>p[i];c+=(p[i]+1)/2*1.0;a[i]=c;}
	for(int i=1;i<=n;i++)
	{
		if(i+k-1>n)continue;
		b=a[i+k-1]-a[i-1];
		lmax=max(b,lmax);
	}
	cout<<fixed<<setprecision(12)<<lmax;
	return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>

int n, A[50];

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

int main(int argc, char const *argv[])
{
    int q, m;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &A[i]);
    }
    scanf("%d", &q);
    for (int i = 0; i < q; i++) {
        scanf("%d", &m);
        if (solve(0, m)) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}



Measured memory_bytes: 2104
import sys
INF=float('inf')
def Bellmanford(n,edges,r):
  d=[INF]*n
  d[r]=0    
  for i in range(n):
    for (u,v,c) in edges:
      if d[u]!=INF and d[u]+c<d[v]:
        d[v]=d[u]+c
        if i==n-1 and v==n-1:
          return 'inf'   
  return (-1)*d[n-1]

N,M=map(int, sys.stdin.readline().split())
Edges=[0]*M

for i in range(M):
  a,b,c=map(int, sys.stdin.readline().split())
  Edges[i]=(a-1,b-1,-c)
    
ans=Bellmanford(N,Edges,0)
print(ans)


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

using namespace std;

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

vector<P> RLE(const string& s) {
    ll cnt = 0;
    char tar = s[0];
    vector<P> res;
    for (char c : s) {
        if (tar == c) cnt++;
        else {
            res.emplace_back(tar, cnt);
            tar = c;
            cnt = 1;
        }
    }
    res.emplace_back(tar, cnt);
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    vector<P> v = RLE(s);
    int sz = v.size();
    ll ans = 0;
    for (int i = 0; i < sz; i++) {
        ans += v[i].second * (v[i].second - 1) / 2;
        if (v[i].first == '<') continue;
        ll val = v[i].second;
        if (i > 0) val = max(val, v[i-1].second);
        ans += val;
    }
    if (v.back().first == '<') ans += v.back().second;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 6932
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  string ans,T;
  cin>>ans>>T;
  int N=ans.size(),M=T.size();
  bool finish=1;
  for(int i=N-M;0<=i;i--){
    if(finish){
      bool flag=1;
      rep(j,i,i+M){
        if(ans[j]!=T[j-i]&&ans[j]!='?'){
          flag=0;
          break;
          }
        }
        if(flag){
          rep(j,i,i+M){
            ans[j]=T[j-i];
            }
          finish=0;
          }
        if(ans[i+M]=='?')
          ans[i+M]='a';
      }
    else{
      if(ans[i]=='?')
        ans[i]='a';
      }
    }
  if(finish)
    ans="UNRESTORABLE";
  cout<<ans<<endl;
  }

Measured memory_bytes: 256
import sys

N,A,B=map(int,input().split())

BIT=0
for i in range(N):
    if (1<<i) & A!=(1<<i) & B:
        BIT+=1

if BIT%2==1:
    print("YES")
else:
    print("NO")
    sys.exit()

check=[0]*(1<<N)

ANS=[]
check[A]=1
check[B]=1

def route(x,i,j):#xから始まるルート,bit iは固定.j 残りbitの個数
    NOW=x
    ANS.append(NOW)
    check[NOW]=1

    for k in range(1<<j):
        for l in range(N):
            if check[NOW ^ (1<<l)]==0 and l!=i:
                NOW=NOW ^ (1<<l)
                check[NOW]=1
                ANS.append(NOW)
                break

    return NOW^(1<<i)

checkbit=[0]*N     
for i in range(N-1,-1,-1):
    for j in range(N):
        if (1<<j)&A!=(1<<j)&B and checkbit[j]==0:
            break
    A=route(A,j,i)
    checkbit[j]=1

ANS.append(B)
print(*ANS)

Measured memory_bytes: 54200
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n+10];
  for(int i=0; i<n; i++){
    cin>>a[i];
  }
  int i=0;
  int sum[n+1]={0};
  for(int i=0; i<n; i++){
  	while(a[i]%2==0){
    	a[i]/=2;
    	sum[i]++;
  	}
  }
  int mi=100000;
  for(int i=0; i<n; i++){
    mi=min(mi,sum[i]);
  }
  cout<<mi<<endl;
}
    
    

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>
#include<iso646.h>
#include<bitset>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

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

// フィボナッチ数列を使う前処理
const ll MAX_N = 1e5 + 10;
ll fib[MAX_N];

void calc_fib(ll n) {
	fib[0] = 1;
	fib[1] = 1;
	for (ll i = 2; i < n + 1; i++) {
		fib[i] = (fib[i - 2] + fib[i - 1]) % MOD;
	}
}


int main() {
	ll N, M;
	cin >> N >> M;
	vll A(M);
	for (auto& e : A)cin >> e;

	calc_fib(N);

	ll ans = 1;
	ll pos = 0;
	for (ll m = 0; m < M; m++) {
		if (pos == A[m]) {
			cout << 0 << endl;
			return 0;
		}
		ans = ans * fib[A[m] - pos - 1] % MOD;
		pos = A[m] + 1;
	}
	ans = ans * fib[(N + 1) - pos - 1] % MOD;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if(a[2]==a[0]+a[1]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solve(void)
{
  int N,M;
  cin>>N>>M;
  vector<int> ANS(N,0);
  for (int i = 0; i < M; i++)
  {
    int A,B;
    cin>>A>>B;
    A--;B--;
    ANS[A]++;
    ANS[B]++;
  }
  for (int i = 0; i < N; i++)
  {
    cout<<ANS[i]<<endl;
  }
  
  
  
  
  return; 
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

Measured memory_bytes: 256
package main

import(
    "fmt"
)



func main() {
    var s int
    fmt.Scan(&s)
    m := make(map[int]int)
    m[s]++
    ans := 2
    for{
        if s%2==0{
            s/=2
        } else {
            s=s*3+1
        }
        if m[s]>0{
            break
        }
        m[s]++
        ans++
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}


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

int main(){
    int i, n;
    char c;
    cin >> n;
    for(i=0; i<n; i++){
        cin >> c;
        if(c == 'Y'){
            cout << "Four";
            return 0;
        }
    }
    cout << "Three";
    return 0;
}

Measured memory_bytes: 256
// 5/10 リアルタイム参加
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

int main() {
    int A, B;
    cin >> A >> B;
    cout << A * B << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i <=n;i++){
    num*=yakusu[i];
  }
  return num;
}

//vc alp(26) ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//cout<<""<<endl;
int main(){
  vc alp= {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  int N;string S;cin>>N>>S;
  
  
  int ma=0;
    f(j,1,N){
      int cnt=0;
      rep(i,26){
        bool right=false,left=false;
        rep(k,j){
         if(S[k]==alp[i])left=true;
        }
        f(k,j,N){
         if(S[k]==alp[i])right=true;
        }
        if(left==true&&right==true)cnt++;
      }
      ma =max(cnt,ma);
  }
  cout<<ma<<endl;
}





Measured memory_bytes: 256