akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.InputStream;

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

    static class AdditionMultiplication {
        public void solve(int testNumber, Reader in, PrintWriter out) throws Exception {
            int n = in.nextInt();
            int k = in.nextInt();
            int result = 1;
            for (int i = 0; i < n; ++i) {
                result = Math.min((result + result), (result + k));
            }
            out.println(result);
        }

    }

    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer;
        private int bytesRead;

        public Reader(InputStream in) {
            din = new DataInputStream(in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg) {
                c = read();
            }
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg) {
                return -ret;
            }
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) {
                buffer[0] = -1;
            }
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) {
                fillBuffer();
            }
            return buffer[bufferPointer++];
        }

    }
}



Measured memory_bytes: 24788
n,m=map(int, input().split())
A=[]
a=list(map(int, input().split()))
for i in  range(n):
  A.append([a[i], 1])
  
l=[]
for i in range(m):
  b,c=map(int, input().split())
  l.append([c,b])

A.extend(l)
A.sort()
A.reverse()
B=[]

j=0
cnt=-1
while cnt<n:
  B.extend([A[j][0]]*A[j][1])
  cnt=cnt+A[j][1]
  if cnt>=n:
    del B[n:]
  j=j+1

print(sum(B))

Measured memory_bytes: 40084
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < (int)(x); i++)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    string s;cin >> s;
    ll res = 0;
    rep(i,10)rep(j,10)rep(k,10){
        ll temp = 1;
        rep(l,n){
            if(s[l]-'0' == i && temp == 1)temp++;
            else if(s[l]-'0' == j && temp == 2)temp++;
            else if(s[l]-'0' == k && temp == 3)temp++;
        }
        if(temp == 4)res++;
    }

    cout << res << endl;

}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

int n;
int a[100000];

signed main() {
	int i;
	
	cin >> n;
	rep(i, n) cin >> a[i];
	sort(a, a + n);
	
	rep(i, n) {
		if (a[i] >= 0) break;
	}
	int k;	//-1倍する個数
	
	if (i == n) { k = n - 1; }
	else if (i == 0) { k = 1; }
	else { k = i; }
	
	int ans = 0;
	rep(i, n) {
		if (i < k) ans += -a[i];
		else ans += a[i];
	}
	cout << ans << endl;
	
	
	int hoge = a[k];
	for (i = k - 1; i > 0; i--) {
		cout << hoge << " " << a[i] << endl;
		hoge = hoge - a[i];
	}
	
	if (k == n - 1) {
		cout << hoge << " " << a[0] << endl;
		return 0;
	}
	
	cout << a[0] << " " << hoge << endl;
	int fuga = a[0] - hoge;
	for (i = k + 1; i < n - 1; i++) {
		cout << fuga << " " << a[i] << endl;
		fuga -= a[i];
	}
	cout << a[n - 1] << " " << fuga << endl;
	return 0;
}

Measured memory_bytes: 2688
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
const long long INF = 1LL<<60;

typedef pair<long long,bool> Pair;

int main(){

double R,PI = 3.14159265358979323846;

PI *= 2.0;

cin >> R;

cout << R*PI << endl;

return 0;

}

Measured memory_bytes: 3788
//#include<bits/stdc++.h>
#include<iostream>
#include<set>
#include<vector>
#include<cmath>
#include<list>
#include<map>
#include<algorithm>
#include<unordered_map>
#include<unordered_set>
#include<iomanip> 
#include<cstdlib> 

#define ll long long

using namespace std;

int main() {
	int k;
	string s;
	cin >> k;
	cin >> s;
	for (int i = 0; i < k && i < s.size(); ++i) cout << s[i];
	if (k < s.size()) cout << "..." << endl;
	else cout << endl;
	return 0;
}

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

#define infi            2e9
#define infl            5e18
#define MX              100005
#define pi              2*acos(0.0)
#define ll              long long
#define rr              read()
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define ms(a,b)         memset(a, b, sizeof(a))
#define loop(i,n)       for(register int i=0;i<n;i++)
#define loop1(i,n)      for(register int i=1;i<=n;i++)

using namespace std;

inline ll read(){char c=getchar();ll num,sign=1;for(;c<'0'||c>'9';c=getchar())if(c=='-')sign=-1;for(num=0;c>='0'&&c<='9';){c-='0';num=num*10+c;c=getchar();}return num*sign;}
// inline ll pw(ll b, ll p){ll ans=1;while(p>0){if(p&1)ans*=b;p>>=1;b*=b;}return ans;}
// inline bool isPrime(ll n){if(n==1)return false;if(n==2)return true;if(!(n%2))return false;for(ll i=3;i<=sqrt(n);i+=2)if(!(n%i))return false;return true;}
// inline ll gcd(ll a, ll b){if(a==0)return b;return gcd(b%a,a);}

// //*************************************  Bitmask Opereations  **********************************//
// int Set(int N,int pos){return N=N | (1<<pos);}
// int reset(int N,int pos){return N= N & ~(1<<pos);}
// bool check(int N,int pos){return (bool)(N & (1<<pos));}
// //********************************************************************************************//


int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    //#ifdef rid.dle//freopen("in.txt", "r", stdin);//#endif
    //freopen("in.txt", "r", stdin);

    int a=rr,b=rr;
    if(a==b)cout << "Draw" << endl;
    else if((a>b&&b!=1) || a==1)cout << "Alice" << endl;
    else if((a<b&&a!=1) || b==1)cout << "Bob" << endl;
    
    return 0;
}


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

int main(){

  int N; cin >> N;
  int ans = 999999;
  int tmp = 0;

  for(int i = 0 ; i < 9 ; ++i){
    tmp = (i+1)*100 + (i+1)*10 +(i+1);
    if(tmp >= N) break;
  }

  ans = tmp;
  

  cout << ans << endl;

}

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

int main() {
  string s;
  cin >> s;
  string res = "";
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '0') {
      res += '0';
    } else if (s[i] == '1') {
      res += '1';
    } else {
      if (res.size() != 0) { res.erase(res.size() - 1, 1); }
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int A, B, C, D, E, F;

int main()
{
    cin >> A >> B >> C >> D >> E >> F;
    float max = 0.0;
    int max_water = 0;
    int max_sugar = 0;
    for (int i = 0; i * 100 * A <= F; i++)
    {
        for (int j = 0; (i * A + j * B) * 100 <= F; j++)
        {
            int water = (i * A + j * B) * 100;
            for (int k = 0; C * k <= (i * A + j * B) * E; k++)
            {
                
                for (int l = 0; (C * k + D * l) <= (i * A + j * B) * E; l++)
                {
                    
                    int sugar = C * k + D * l;
                    if (sugar + water > F )
                        continue;
                    float noudo;
                    if (sugar <= 0) {
                        noudo = 0;
                    }
                    else {
                        noudo = (100.0 * sugar) / (sugar + water);
                    }
                    if (noudo >= max)
                    {
                        max = noudo;
                        max_water = water;
                        max_sugar = sugar;
                    }
                }
            }
        }
    }
    cout << max_water + max_sugar << " " << max_sugar << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int a,b;
  cin>>a>>b;
  if(a%2==0||b%2==0) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<map>
#include<string>
#include<iostream>

using namespace std;
int main(void){
    string S;

    int max_length=0;
    int tmp_length=0;

    cin>>S;

    for(int head=0;head<S.length();head++){
        for(int tail=head;tail<S.length();tail++){
            if(S[tail]=='A'||S[tail]=='C'||S[tail]=='G'||S[tail]=='T'){
                tmp_length++;
            }else{
                break;
            }
        }
        if(tmp_length>max_length)
            max_length = tmp_length;
        tmp_length=0;
    }

    cout<<max_length<<endl;
    return 0;

}


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


int main(){
	// your code goes here
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    
    long long int n;
    string s;
    cin>>n>>s;
    long long int i;
    long long int count=0;
    int ch=0;
    for(i=0;i<n;i++){
        if(ch==0){
            if(s[i]=='A'){
                ch=1;
            }
        }
        else if(ch==1){
            if(s[i]=='B'){
                ch=2;
            }
            else if(s[i]=='A'){
                ch=1;
            }
            else{
                ch=0;
            }
        }
        else if(ch==2){
            if(s[i]=='C'){
                ch=0;
                count++;
            }
            else if(s[i]=='A'){
                ch=1;
            }
            else{
                ch=0;
            }
        }    
        
    }
    cout<<count;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define elnd endl //* missspell check


void solve(long long N, long long M, string &S){
    reverse(ALL(S));
    vll rec;
    ll i=0, j;
    while(i < N){
        for( j = min(i+M, N); j >i; j--){
            if(S[j]=='0'){
                rec.push_back(j-i);
                break;
            }
        }
        if(j == i){
            cout<<-1<<endl; return;
        }
        else{ i = j;}
    }
    reverse(ALL(rec));
    for(auto x: rec) cout<<x<<" ";
    cout<<endl;
    return;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    string S;
    cin>>S;
    solve(N, M, S);
    return 0;
}


Measured memory_bytes: 1528
import java.util.Arrays;
import java.util.Scanner;

public class Main 
{

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		long m = sc.nextInt(); //judges
		long v = sc.nextInt(); //problem voted per judge
		int p = sc.nextInt(); //how many problems get chosen
		
		long[] a = new long[n];
		for(int i = 0; i < n; i++)
			a[i] = sc.nextLong();
		
		Arrays.sort(a);
		
		int l = 0;
		int r = n-1;
		
		int worstgud = 3*n;
//		System.out.println(Arrays.toString(a));
		while(r>=l)
		{
			int consider = (l+r)/2;
			
			//can this problem get chosen?
			long score = a[consider] + m; //this problem will get this much score
			//pth highest score should be <= score^
//			System.out.println(l + " " + r + " " + consider + ": score " + score);
			
			int beaters = 0; //initial beaters
			for(int i = 0; i < n; i ++)
			{
				if(a[i] > score)beaters++;
			}
			//beaters must be less than p
			
			long[] b = a.clone();
			long rem = (m*v)-m;
			for(int i = 0; i < n && rem > 0; i++)
			{ //distribute rest of score
				if(i == consider)continue;
				
				//give b[i] score
				long give = Math.min(score - b[i], m); //up to m that doesn't beat score
				
				give = Math.min(give, rem);
				if(give > 0)
				{
					b[i] += give;
					if(b[i]>score)beaters++;
					rem -= give;
				}
				else 
				{
					break;
				}
			}
			
			//distribute rem into beaters first
			for(int i = n-1; i >= 0 && rem > 0; i--)
			{
				boolean wasbeater = b[i] > score;
				long alreadygiven = b[i] - a[i];
				long givefroma = m;
				long give = givefroma - alreadygiven; //give this many more
				give = Math.min(give, rem);
				
				b[i] += give;
				rem -= give;
				if(!wasbeater && b[i] > score)beaters++; //now beater
			}
			
			if(rem == 0 && beaters < p)
			{
//				System.out.println("GUD ");
				//gud
				worstgud = Math.min(worstgud, consider);
				r = consider-1;
			}
			else
			{
//				System.out.println("NOP");
				//nop
				l = consider+1;
			}
			
		}
		
//		System.out.println("wg " + worstgud);
		System.out.println(n-worstgud);
	}

}


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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    int n;
    cin >> n;

    vector< pair< pair<string, int>, int> > v;
    rep(i, n){
        string s;
        int p;
        cin >> s >> p;
        v.push_back({{s, -p}, i});
    }
    SORT(v);

    rep(i, n){
        cout << v[i].second + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
A = [int(input()) for i in range(M)]
B = [1]*(N+2)
for a in A:
    B[a] = 0
MOD = 10**9+7

if not B[0]:
    print(0)
    exit()

dp = [0]*(N+1)
dp[0] = 1
for i in range(N):
    if B[i+1]:
        dp[i+1] += dp[i]
        dp[i+1] %= MOD
    if i+2 <= N and B[i+2]:
        dp[i+2] += dp[i]
        dp[i+2] %= MOD
print(dp[-1])

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

string FMT_F = "%.15f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto A = RDA;
	auto index = A.MAKE_IDX();

	long pos, size = A[index[0]];
	foreach (ii, i; index[1..$])
	{
		if (A[i] > size*2)
		{
			pos = ii+1;
		}
		size += A[i];
		debug writeln(A[i], " ", size, " ", pos);
	}
	writeln(N - pos);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 6328
use proconio::{fastout, input};
const MOD: i128 = 1_000_000_000 + 7;

#[fastout]
fn main() {
    input! {
        n: usize,
    }

    let mut pow10 = vec![1i128; n + 1];
    let mut pow9 = vec![1i128; n + 1];
    let mut pow8 = vec![1i128; n + 1];
    for i in 1..=n {
        pow10[i] = pow10[i - 1] * 10 % MOD;
        pow9[i] = pow9[i - 1] * 9 % MOD;
        pow8[i] = pow8[i - 1] * 8 % MOD;
    }

    println!("{}", (pow10[n] + 2 * (MOD - pow9[n]) + pow8[n]) % MOD);
}


Measured memory_bytes: 48948
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array;


void main() {
    writeln(readln.chomp.canFind('9') ? "Yes" : "No");
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 256
from collections import defaultdict

N, K = map(int, input().split())
d = defaultdict(int)

for _ in range(N):
    a, b = map(int, input().split())
    d[a] += b

n = 0
for i in range(10**5):
    n += d[i+1]
    if n >= K:
        print(i+1)
        exit()

Measured memory_bytes: 17472
from collections import defaultdict

N = int(input())
S = input()
cnt = defaultdict(dict)

for i in range(2**N):
    r, b = [], []
    
    for j in range(N):
        if (i>>j)&1:
            r.append(S[j])
        else:
            b.append(S[j])
    
    r = ''.join(r)
    b = ''.join(b)
    
    if b not in cnt[r]:
        cnt[r][b] = 1
    else:
        cnt[r][b] += 1

S = S[::-1]
ans = 0

for i in range(2**N):
    r, b = [], []
    
    for j in range(N):
        if (i>>j)&1:
            r.append(S[j])
        else:
            b.append(S[j])
    
    r = ''.join(r)
    b = ''.join(b)
    
    if r in cnt[b]:
        ans += cnt[b][r]

print(ans)

Measured memory_bytes: 179328
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<vector>
using namespace std;
#define MAX_N 100001
#define INF 2147483647
#define REP(i,COUNT) for(int i=0;i<(int)(COUNT);i++)
struct edge{
  int to, cost;
};
typedef vector<vector<edge> > AdjList;
AdjList graph;
typedef pair<int, int> P;
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
vector<int> dist;
vector<int> dist2;
vector<int> prever;
void dijkstra(int n,int s){
  dist = vector<int>(n,INF);
  dist2 = vector<int>(n,INF);
  prever = vector<int>(n,-1);
  dist[s] = 0;

  priority_queue<P, vector<P> , greater<P> > que;
  que.push(P(0,s));
  
  while(!que.empty()){
    P p = que.top(); que.pop();
    int v = p.second;
    int d = p.first;
    //if(dist[v] < d){
    //  cout << dist[v] << " " << d << endl;
    //  continue;
    //}
    REP(i,graph[v].size()){
      edge e = graph[v][i];
      if(dist[e.to] > dist[v] + e.cost){
        dist[e.to] = dist[v] + e.cost;
        prever[e.to] = v;
        que.push(P(dist[e.to],e.to));
      }

    }

  }
}

int main()
{
  int N,M,a,b,cnt=0,f=0;
  cin >> N >> M;
  vector<vector<int> > Adj(N+1,vector<int>(N+1,0));
  vector<int> vs(0);
  REP(i,N){
    vs.push_back(i+1);
  }
  REP(i,M){
    cin >> a >> b;
    Adj[a][b] = 1;
    Adj[b][a] = 1;
  }
  
  do{
    f = 1;
    REP(i,N-1){
      if(!Adj[vs[i]][vs[i+1]])
        f = 0;
    }
    if(f)
      cnt++;
  }while(next_permutation(vs.begin()+1,vs.end()));
  
  cout << cnt<< endl;
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}

//木の根を求める
int find(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y) return ;
  if(ranks[x] < ranks[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(ranks[x] == ranks[y]) ranks[x]++;
  }
}

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



Measured memory_bytes: 256
// {{{
#include <bits/stdc++.h>
using namespace std;
using ll = long long int; // int_fast64_t;
template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;
using vi = vt<int>;
using vvi = vvt<int>;
using vl = vt<ll>;
using vvl = vvt<ll>;
constexpr int INF = 1 << 30;  // 1073741824 2倍すると -2147483648
constexpr ll INFL = 1l << 62; // 4611686018427387904 2倍すると-0.9*10^18
constexpr int dx4[] = {0, 1, 0, -1};
constexpr int dy4[] = {1, 0, -1, 0};
constexpr int dx8[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy8[] = {0, -1, 0, 1, -1, -1, 1, 1};
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define RANGE(i, a, b) for (int i = (a); i <= (b); i++)
#define RANGER(i, a, b) for (int i = (b); i >= (a); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, 0, (n))
// }}}
int main() {
  vl A;
	ll sum = 0;
	int N;
	cin >> N;
	A.push_back(0);
	REP(i, N) {
		int k;
		cin >> k;
		sum += k;
		A.push_back(k);
	}
	ll r = INFL;
	ll tmp = sum;
	REP(i, N) {
		tmp -= A[i];
		r = min(r, abs(tmp - (sum-tmp)));
	}
	cout << r << endl;
	return 0;
}
/* vim: set fdm=marker: */


Measured memory_bytes: 2548
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String n = sc.next();
		int a = Integer.parseInt((s+n));
		if(Math.pow((int)Math.sqrt(a), 2)==a) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

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

int N;

int main () {
  cin >> N;
  long long power = 1;
  long long mod = 1e9+7;
  
  for (long long i = 1; i <= N; i++){
    power = (power * i) % mod;
  }
  cout << power << endl;
}

Measured memory_bytes: 256
let print_ary a =
  Array.iteri (fun i e -> Printf.printf (if i = 0 then "%d" else " %d") e) a;
  print_newline ()

let rev_iter f a =
  let rec doit i =
    if i >= 0 then (f (Array.get a i); doit (i - 1))
  in
  doit (Array.length a - 1)

let counting_sort a b k =
  let c = Array.make (k + 1) 0 in
  Array.iter (fun e -> c.(e) <- c.(e) + 1) a;
  Array.iteri (fun i _ -> if i = 0 then () else c.(i) <- c.(i) + c.(i - 1)) c;
  rev_iter (fun e -> b.(c.(e) - 1) <- e; c.(e) <- c.(e) - 1) a

let () =
  let n = read_int () in
  let a = Array.init n (fun _ -> Scanf.scanf "%d " (fun e -> e)) in
  let k = Array.fold_left max (-1) a in
  let b = Array.make n 0 in
  counting_sort a b k;
  print_ary b

Measured memory_bytes: 36208
#include<iostream>
#include<cstdio>
#include<map>
using namespace std;
int n,m,i,j,k;
char s[100];
long long ans;
map<string,int> tot;
int main(){
	scanf("%d",&n);scanf("%s",s);tot.clear();
	for (i=0;i<(1<<n);i++){
		string now="";for (j=0;j<n;j++) if (!((i>>j)&1)) now+=s[j];
		now+="*";for(j=n-1;j>=0;j--) if ((i>>j)&1) now+=s[j];
		tot[now]++;
	}
	for (i=0;i<(1<<n);i++){
		string now="";for (j=0;j<n;j++) if ((i>>j)&1) now+=s[n*2-1-j];
		now+="*";for(j=n-1;j>=0;j--) if (!((i>>j)&1)) now+=s[n*2-1-j];
		ans+=tot[now];
	}printf("%lld\n",ans);return 0;
}

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

#define _USE_MATH_DEFINES

#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <functional>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <iterator>
#include <bitset>
#include <complex>
#include <limits>
#include <random>
#include<fstream>
#include<array>


using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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 (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;

const double EPS = 1e-9;

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

	int K;
	cin >> K;


	rep(i, 0, K)
	{
		cout << "ACL";
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long int
#define F first
#define S second
#define pb push_back
#define mpp make_pair
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;

const int N=2e3+5;
const ll infi=1e9+5;
const ll mod=1e9+7;

int main()
{
	ll t;
	set<ll>s;
	ll n;
	cin>>n;

	ll a[n+5],i;
	ll ans=1;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		if(!s.empty())
		{
			auto it=s.begin();
			ll val=*it;
			if(val >= a[i])
			ans++;
			s.insert(a[i]);
		}
		else{
			s.insert(a[i]);
			continue;
		}
	}
	cout<<ans<<"\n";
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
string rv(string s){
  reverse(s.begin(),s.end());
  return s;
}
int main(void){
  string s,c,a; cin>>s;
  int n=s.size();
  for(int i=1; i<=(n-1)/2; ++i) c+=s[i-1];
  for(int i=(n+3)/2; i<=n; ++i) a+=s[i-1];
  if(s==rv(s)&&c==rv(c)&&a==rv(a)) cout<<"Yes"; else cout<<"No";
  return 0;
}

Measured memory_bytes: 3532
#include <stdio.h>

#define MAX 100004
#define nil -1

void rec(int, int);
void print(int);

typedef struct{
  int p;
  int left;
  int right;
}node;

node Node[MAX];
int Depth[MAX];

int main(){
  int n, a, b, id, k, node, root, left;

  scanf("%d",&n);
  for(a = 0; a < n; a++){
    Node[a].p = Node[a].left = Node[a].right = nil;
  }

  for(a = 0; a < n; a++){
    scanf("%d%d",&id,&k);
    for(b = 0; b < k; b++){
      scanf("%d",&node);
      if(b == 0) Node[id].left = node;
      else Node[left].right = node;
      left = node;
      Node[node].p = id;
    }
  }

  for(a = 0; a < n; a++){
    if(Node[a].p == nil) root = a;
  }

  rec(root,0);

  for(a = 0; a < n; a++){
    print(a);
  }

  return 0;
}

void rec(int node, int p){
  Depth[node] = p;
  if(Node[node].right != nil) rec(Node[node].right,p);
  if(Node[node].left != nil) rec(Node[node].left,p+1);
}

void print(int node){
  int a, left;
  printf("node %d: parent = %d, ",node,Node[node].p);
  printf("depth = %d, ",Depth[node]);

  if(Node[node].p == nil) printf("root, ");
  else if(Node[node].left == nil) printf("leaf, ");
  else printf("internal node, ");

  printf("[");
  left = Node[node].left;
  for(a = 0; left != nil; a++){
    if(a != 0) printf(", ");
    printf("%d",left);
    left = Node[left].right;
  }
  printf("]\n");
}



Measured memory_bytes: 6432
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;

int h,w,x;
char s[1000][1000];
bool visited [1000][1000];
pair<int,int> start,goal;
queue<pair<int,pair<int,int>>> q;
vector<pair<int,int>> ino;

int main(){
  char a,b,c;cin>>a>>b>>c;
  if(a==b){
    cout << "H";
  }else{
    cout << "D";
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
const int N=1e6;
int n,a[N+10],b[N+10],c[N+10],v1[N+10],v2[N+10];
int main() {
    scanf("%d",&n);
    for (int i=1;i<=n;i++) scanf("%d",&a[i]);
    for (int i=1;i<=n;i++)
        if (i%2) b[i/2+1]=a[i];
        else c[i/2]=a[i];
    for (int i=1;i<=n/2;i++)
        v1[b[i]]++;
    for (int i=1;i<=n/2;i++)
        v2[c[i]]++;
    int max0=0;
    for (int i=1;i<=N;i++)
        if (v1[i]>v1[max0]) max0=i;
    int max1=0;
    for (int i=1;i<=N;i++)
        if (v2[i]>v2[max1]) max1=i;
    if (max0!=max1) {
        printf("%d\n",n-v1[max0]-v2[max1]);
        return 0;
    }
    int maxx=0,maxy=0;
    for (int i=1;i<=N;i++)
        if (i!=max0) maxx=max(maxx,v1[i]);
    for (int i=1;i<=N;i++)
        if (i!=max0) maxy=max(maxy,v2[i]);
    printf("%d\n",n-max(v1[max0]+maxy,v2[max0]+maxx));
    return 0;
}


Measured memory_bytes: 10880
#include<iostream>

using namespace std;

class Monstar {
public:
	int hp,atk;
	
	Monstar(int inputHp, int inputAtk) {
		hp = inputHp;
		atk = inputAtk;
	}
	void BeAtked(Monstar Ememy);
};

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	Monstar Takahashi(a,b);
	Monstar Aoki(c,d);

	while (true) {
		Aoki.BeAtked(Takahashi);
		Takahashi.BeAtked(Aoki);
		if (Takahashi.hp <= 0 || Aoki.hp <= 0)
			break;
	}
	if (Aoki.hp <= 0||Aoki.hp<=0&&Takahashi.hp<=0)
		cout << "Yes";
	else if (Takahashi.hp <= 0)
		cout << "No" ;
	return 0;
}

void Monstar::BeAtked(Monstar Ememy) {
	hp -= Ememy.atk;

}

Measured memory_bytes: 3640
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long N, K, COUNT = 1;
	string S;
	cin >> N >> K >> S;
	for (int i = 0; i < S.size() - 1; i++) {
		if (S[i] != S[i + 1]) COUNT++;
	}
	cout << N - max(1LL, COUNT - 2 * K) << endl;
}

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

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x)   (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second
#define pf printf
#define sf scanf

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

const int INF = (1<<25);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){

  char class_name[9][16];
  int before[9];
  int after[9];
  rep(i,9){
    cin>> class_name[i]>> before[i]>> after[i];
  }
  rep(i,9){
    pf("%s %d %d\n",class_name[i],before[i]+after[i],before[i]*200+after[i]*300);
  }
}

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

int main(){
  char a;
  cin>>a;
  char ans;
  switch(a){
    case 'A':
      ans = 'T';
      break;
    case 'T':
      ans = 'A';
      break;
    case 'C':
      ans = 'G';
      break;
    case 'G':
      ans = 'C';
      break;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iomanip>
#include <string>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;
#define nin(n) int n; cin >> n;
#define kin(k) int k; cin >> k;
int main() {
  int n;
  cin >> n;
  if(n/100==0||n/100>12){
    if(n%100==0||n%100>12){
      cout << "NA" << endl;
    }
    else{
      cout <<"YYMM" << endl;
    }
  }
  else{
    if(n%100>=1&&n%100<=12){
      cout << "AMBIGUOUS" << endl;
    }
    else{
      cout <<"MMYY" << endl;
    }
  }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]) {
  Scanner sc=new Scanner(System.in);
        
        int n=sc.nextInt();
        int k=sc.nextInt();
        Integer[] p=new Integer[n];
        for(int i=0;i<n;i++)
        p[i]=sc.nextInt();
        
        Arrays.sort(p);
        long sum=0;
        for(int i=0;i<k;i++)
        sum+=p[i];
 
 
      System.out.println(sum);
    }
}

Measured memory_bytes: 38960
// AOJ 585 Nearest Two Points
// 2017.9.24 bal4u
// 2018.3.17
// 2018.5.3

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct { int x, y; } PP;

#define INF  0x10101010

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	if (c == '-') {	c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

PP p[500005], L[500005], R[500005];

#define BASE 10000
#define VMAX 20002
int f[VMAX+1];

void counting_sort(int n, PP *ps, PP *po)
{
	int i, x;

	for (i = 0; i < n; i++) f[BASE + ps[i].x]++;
	for (i = 1; i <= VMAX; i++) f[i] += f[i-1];
	for (i = n-1; i >= 0; i--) {
		x = BASE + ps[i].x, po[--f[x]] = ps[i];
	}
}

void merge(PP *p, int low, int mid, int high)
{
	int n1, n2, i, j, k;

	n1 = mid-low, n2 = high-mid;
	memcpy(L, p+low, sizeof(PP)*n1);
	memcpy(R, p+mid, sizeof(PP)*n2);
	L[n1].y = R[n2].y = INF;

	i = 0, j = 0;
	for (k = low; k < high; k++) {
		if (L[i].y <= R[j].y) p[k] = L[i++];
		else                  p[k] = R[j++];
	}
}

int maxt;
int closest_pair(int n, PP *p)
{
	int m, i, j, t;
	int ans, d, x;

	if(n <= 1) return INF;
	m = n >> 1;
	x = p[m].x;
	ans = closest_pair(m, p);
	d   = closest_pair(n-m, p+m);
	if (d < ans) ans = d;
	merge(p, 0, m, n);

	t = 0;
	for (i = 0; i < n; i++) {
		d = p[i].x-x;
		if (d*d >= ans) continue;

		for (j = 0; j < t; j++) {
			int dx = p[i].x - L[t-1-j].x;
			int dy = p[i].y - L[t-1-j].y;
			int dy2 = dy*dy;
			if (dy2 >= ans) break;
			d = dx*dx + dy2;
			if (d < ans) ans = d;
		}
		L[t++] = p[i];
	}
	return ans;
}

int main()
{
	int n, i;

	n = in();
	for (i = 0; i < n; i++) L[i].x = in(), L[i].y = in();
	counting_sort(n, L, p);
	printf("%d\n", closest_pair(n, p));
	return 0;
}


Measured memory_bytes: 12484
#include <bits/stdc++.h>
using namespace std; 
int main() {
  int n, l; cin >> n >> l;  int g=100000; int h=0;
  vector<int> a(n);
  for (int i=0; i<n;i++) {
    a[i]=l+i;
      g=min(g,abs(a[i]));
      if(g==abs(a[i])){
        h=a[i];
      }
  }
 int count=0; 
  for (int i=0; i<n;i++) {
    count+=a[i];
}
  count-=h;
  cout << count << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <algorithm>       // for next_permutation
#include <vector>
#include <bits/stl_numeric.h>

#define DEBUG 0
#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;


ll solve() {
    int K,A,B;
    cin >> K >> A >> B;

    ll res = 1;

    //開始時はビスケット1つ
    //ビスケットを1枚増やす
    //ビスケットA枚を1円に交換する
    //1円をビスケットB枚に交換する

    //A < B - 2 ならAを集めて、Bにすべき


    if(A + 2 >= B || K + 1 <= A)
    {
        res = 1 + K;
        return res;
    }

    if(res < A)
    {
        K -= (A-res);
        res = A;
    }
    bool flg = true;
    while(K > 0)
    {
        if(flg)
        {
            if(K == 1)
            {
                ++res;
            }
            else
            {
                res -= A;
            }
        }
        else
        {
            res += B;
        }
        --K;
        flg = !flg;
    }


    return res;
}

int main()
{
    cout << solve() << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int[] b = new int [a];
        for(int i = 0; i < a ; i++) {
            b[i] = sc.nextInt();
        }
        for(int i = a - 1; i > -1; i--) {
            if(i == 0) {
                System.out.println(b[i]);
            } else {
                System.out.print(b[i] + " ");
            }
        }
    }
}


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

int main(){
    int n,m;
    cin>>n>>m;
    vector<map<int,int>>line(n);
    rep(i,n){
        ll a,b;
        cin>>a>>b;
        line[i][0]=a;
        line[i][1]=b;
    }
    sort(line.begin(),line.end());
    ll total=0;
    
    rep(i,n){
        rep(j,line[i][1]){
            m-=1;
            total+=line[i][0];
            if(m==0) break;
        }
        if(m==0) break;
        

    }
   
    cout<<total<<endl;
}

   

Measured memory_bytes: 14336
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string.h>
#define _USE_MATH_DEFINES
#define ln long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
using namespace std;

int max(int *ary) {
	int max = 0;
	for (int i = 0; i < sizeof(ary) / sizeof(ary[0]); i++)
		if (max < ary[i]) max = ary[i];
	return max;
}

int nmax(int *ary) {
	int max = 0, num;
	for (int i = 0; i < sizeof(ary) / sizeof(ary[0]); i++)
		if (max < ary[i]) {
			max = ary[i];
			num = i;
		}
	return max, num;
}

int main() {
	int w, h, n, x, y, a, v[100][100] = {}, ans = 0;
	cin >> w >> h >> n;

	for (int i = 0; i < n; i++) {
		cin >> x >> y >> a;
		switch (a) {
		case 1:
			for (int j = 0; j < h; j++)
				for (int k = 0; k < x; k++)
					v[j][k] = 1;
			break;
		case 2:
			for (int j = 0; j < h; j++)
				for (int k = x; k < w; k++)
					v[j][k] = 1;
			break;
		case 3:
			for (int j = 0; j < y; j++)
				for (int k = 0; k < w; k++)
					v[j][k] = 1;
			break;
		case 4:
			for (int j = y; j < h; j++)
				for (int k = 0; k < w; k++)
					v[j][k] = 1;
			break;
		}
	}

	for (int j = 0; j < h; j++)
		for (int k = 0; k < w; k++)
			if (v[j][k] == 0)
				ans++;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
	int k,i,c,len,a1;
	char s[101],a[101];
	scanf("%d %s",&k,s);
	len=strlen(s);
	c=0;
	for(i=0;i<len;i++){
		c++;
	}
	a1=0;
	a1=c-k;
	c=c-a1;
	if(a1>0){
		for(i=0;i<c;i++){
			printf("%c",s[i]);
		}
		printf("...\n");
	}
	else	printf("%s\n",s);
	return 0;
}


Measured memory_bytes: 1616
gyou,retu=map(int,input().split())
l=[input() for _ in range(gyou)]
d=[(-1,-1),(-1,0),(-1,1),(0,-1),(0,1),(1,-1),(1,0),(1,1)]
for g in range(gyou):
  preans=str()
  for r in range(retu):
    s=0
    if l[g][r]=="#":
      preans += "#"
    else:
      for x in range(8):
        a,b=d[x]
        try:
          if l[g+a][r+b]=="#" and g+a>=0 and r+b>=0:
            s+=1
        except IndexError:
          s+=0
      preans += str(s)
  print(preans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
using namespace std;
int main() {
	int n, ans = 0;
	cin >> n;
	string s;
	cin >> s;
	for (int i = 0; i < n; i++) {
		string k;
		cin >> k;
		for (int i = 0; i < k.size(); i++) {
			for (int j = 1; j < k.size(); j++) {
				bool bo = true;
				for (int l = 0; l < s.size(); l++) {
					if (i + j*l > k.size()) bo = false;
					else if (s[l] != k[i + j*l]) bo = false;
				}
				if (bo) {
					ans++;
					goto stop;
				}
			}
		}
	stop:;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3164
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll>Q;


int main(void){
    ll x;
    cin>>x;
    if(x<=6){
        cout<<1<<endl;
        return 0;
    }
    ll ans1=0;
    ll ans2=0;
    ll num1 =x/11;
    ll num2 =(x-6)/11;
    if(x%11!=0)num1++;
    ans1=2*num1;
    if((x-6)%11!=0)num2++;
    ans2=2*num2+1;
    cout<<min(ans1,ans2)<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define For(i, a, b) for(register int i = a; i <= b; ++i)
using namespace std;
const int maxn = 2e5 + 5;
const int mod = 1e9 + 7;
char s[maxn];
int dp[maxn], sum[maxn], n, flag, trans[3] = {0, -1, -1};
 
void Add(int & a, const int &b) {
	a += b;if(a >= mod) a -= mod;
}
 
int main() {
	scanf("%s", s + 1);
	n = strlen(s + 1), dp[0] = 1;
	For(i, 1, n) sum[i] = (sum[i - 1] + (s[i] - 'a' + 1)) % 3;
	For(i, 2, n)
		if(s[i] == s[i - 1]) 
			{flag = 1; break;}
	if(!flag) return printf("1"), 0;
	int from; dp[0] = 1;
	For(i, 1, n) {
		if(!sum[i] && i < n) dp[i] = 1;
		Add(dp[i], dp[i - 1]);
		from = trans[(sum[i] + (s[i] == 'a' ? 1 : 2)) % 3];
		if(~from) Add(dp[i], dp[from]);
		trans[sum[i]] = i;
	}
	printf("%d", dp[n]);
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main() {

    int n;

    scanf("%d", &n);

    if (n < 15)
        printf("%d\n", 800*n);

    else if (n >= 15) {
        printf("%d\n", ((800*n) - (((n/15)*200))));
    }

    return 0;
}

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

typedef long long ll;
typedef long double ld;
//#define int ll
//#define endl '\n'

// use unique(x) - removec consecutive items, returns vec.begin() + number of items
// for vector: sort(all(vec)); vec.erase(unique(all(vec)), vec.end());
// use iota(all(vec), 0) for filling a vector with 0,1,2...
// use fill(all(vec), 1) for filling a vector with 1,1,1...
// use rotate(vec.begin(), vec.begin() + 1, vec.end()) to rotate a vector | middle arg becomes first
// print number in binary -> cout << bitset<20>(n);

const int N=200010,mod=1e9+7;
int n,m;
int g[N],cnt[N];
int find(int u){return g[u]==u?u:g[u]=find(g[u]);}
main(){
	cin.tie(0);cin.sync_with_stdio(0);
	cin>>n>>m;
	iota(g,g+n,0);
	for(int i=0;i<m;++i){
		int u,v;cin>>u>>v;--u;--v;
		if(u>v)swap(u,v);
		if(find(u)!=find(v))
			g[find(u)]=find(v);
	}
	int res=0;
	for(int i=0;i<n;++i)res=max(res,++cnt[find(i)]);
	cout<<res<<endl;
}


Measured memory_bytes: 10496
N = int(input())
S = input()
max_cnt = 0
for i in range(N):
  li1 = [0]*26
  li2 = [0]*26
  cnt = 0
  for j in S[i:]:
    li1[ord(j)-97]+=1
  for j in S[:i]:
    li2[ord(j)-97]+=1
  for j in range(26):
    if(li1[j]>0 and li2[j]>0):
      cnt += 1
  max_cnt = max(max_cnt,cnt)
print(max_cnt)


Measured memory_bytes: 3188
#include<iostream>
#include<string>

using namespace std;

int A,B;
string S;

int main(void) {
    bool flag = true;
    cin>>A>>B;
    cin>>S;

    for(int i = 0;i < S.size();i++) {
        if(i != A) {
            if(!(S[i] >= '0' && S[i] <= '9')) {
                flag = false;
            }
        } else {
            if(S[i] != '-') 
                flag = false;
        }
    }

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

    return 0;
}


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

int main(){
int n,b=0;
bool a=false;
int ans[30];
ans[0]=1;
for(int i=1;i<30;i++){
ans[i]=0;}
cin>>n;
for(int i=2;i<n+1;i++){
for(int j=0;j<30;j++){
ans[j]*=i;
ans[j]+=b;
if(ans[j]<10)b=0;
if(ans[j]>=10){
b=(ans[j]-ans[j]%10)/10;
ans[j]%=10;
}
}
}
for(int i=29;i>-1;i--){
if(ans[i]!=0){
a=true;}
if(a){
cout<<ans[i];}}
cout<<endl;}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp107 {
    class Program {
        static void Main(string[] args) {
            var st = Console.ReadLine().Split().Select(long.Parse).ToArray();

            long N = st[0];
            long T = st[1];

            var t = Console.ReadLine().Split().Select(long.Parse).ToArray();

            long ans = T * N;

            long choufuku = 0;

            for (int i = 1; i < N; i++) {
                if (t[i] - t[i - 1] < T) {
                    choufuku += T - (t[i] - t[i - 1]);
                }
            }

            Console.WriteLine(ans - choufuku);
        }
    }
}


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

#define int long long
#define otp(n) cout << n;
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define ctv(v) rep(i,(v).size()) otp(v[i]) cte
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define repv(i,v) for(int i=0;i<(v).size();i++)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

int a,b,c;

main() {
    cin >> a >> b >> c;
    int x=a%b;
    rep1(i,b) {
        if (x*i%b == c) {
            ct("YES")
            return 0;
        }
    }
    ct("NO")
}

Measured memory_bytes: 256