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

struct CWW{
    CWW(){
        cin.tie(0);
        ios_base::sync_with_stdio(0);
        cout<<fixed<<setprecision(15);
    }
}STAR;

using D=double;

const D EPS=1e-8;
const D INF=1e9;

const int COUNTER_CLOCKWISE=1;
const int CLOCKWISE=-1;
const int ONLINE_FRONT=2;
const int ONLINE_BACK=-2;
const int ON_SEGMENT=0;

using Point=complex<D>;

struct Segment{
    Point p1,p2;
    Segment(const Point &p1=Point(),const Point &p2=Point()):p1(p1),p2(p2){}
};

struct Line{
    Point p1,p2;
    Line(const Point &p1=Point(),const Point &p2=Point()):p1(p1),p2(p2){}
};

struct Circle{
    Point c;
    D r;
    Circle(const Point &c=Point(),const D &r=0.0):c(c),r(r){}
};

using Polygon=vector<Point>;

#define EQ(a,b) (abs((a)-(b))<EPS)

istream& operator>>(istream &is,Point &a){
    D x,y;
    is>>x>>y;
    a=Point(x,y);
    return is;
}

ostream& operator<<(ostream& os,const Point &a){
    os<<real(a)<<" "<<imag(a);
    return os;
}

istream& operator>>(istream &is,Line &l){
    Point p1,p2;
    is>>p1>>p2;
    l=Line(p1,p2);
    return is;
}

istream& operator>>(istream &is,Segment &s){
    Point p1,p2;
    is>>p1>>p2;
    s=Segment(p1,p2);
    return is;
}

D dot(const Point &a,const Point &b){
    return real(a)*real(b)+imag(a)*imag(b);
}

D cross(const Point &a,const Point &b){
    return real(a)*imag(b)-imag(a)*real(b);
}

Point projection(const Point &a,const Point &b){
    return a*real(b/a);
}

Point projection(const Line &l,const Point &a){
    return l.p1+projection(l.p2-l.p1,a-l.p1);
}

Point reflection(const Line &l,const Point &a){
    Point p=projection(l,a);
    return 2.0*p-a;
}

int ccw(Point a,Point b,Point c){
    b-=a;c-=a;
    if(cross(b,c)>EPS)return COUNTER_CLOCKWISE;
    if(cross(b,c)<-EPS)return CLOCKWISE;
    if(dot(b,c)<-EPS)return ONLINE_BACK;
    if(norm(b)+EPS<norm(c))return ONLINE_FRONT;
    return ON_SEGMENT;
}

bool isOrthogonal(const Point &a,const Point &b){
    return EQ(dot(a,b),0.0);
}

bool isOrthogonal(const Point &a1,const Point &a2,const Point &b1,const Point &b2){
    return isOrthogonal(a2-a1,b2-b1);
}

bool isOrthogonal(const Line &l,const Line &m){
    return isOrthogonal(l.p1,l.p2,m.p1,m.p2);
}

bool isParallel(const Point &a,const Point &b){
    return EQ(cross(a,b),0.0);
}

bool isParallel(const Point &a1,const Point &a2,const Point &b1,const Point &b2){
    return isParallel(a1-a2,b1-b2);
}

bool isParallel(const Line &l,const Line &m){
    return isParallel(l.p1,l.p2,m.p1,m.p2);
}

bool intersect(const Point &a1,const Point &a2,const Point &b1,const Point &b2){
    return ccw(a1,a2,b1)*ccw(a1,a2,b2)<=0&&
            ccw(b1,b2,a1)*ccw(b1,b2,a2)<=0;
}

bool intersect(Segment &s,Segment &t){
    return intersect(s.p1,s.p2,t.p1,t.p2);
}

Point crossPoint(const Segment &s1,const Segment &s2){
    Point  base=s2.p2-s2.p1;
    D d1=abs(cross(base,s1.p1-s2.p1));
    D d2=abs(cross(base,s1.p2-s2.p1));

    D t=d1/(d1+d2);
    return s1.p1+(s1.p2-s1.p1)*t;
}



int main(){
    int Q;cin>>Q;
    while(Q--){
        Segment s,t;
    cin>>s>>t;
    cout<<crossPoint(s,t)<<endl;
    }
    return 0;
}

Measured memory_bytes: 3300
import sys, os

if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

f = lambda:list(map(int, input().split()))


def gcd(a,b):
    return b if a == 0 else gcd(b%a, a)

def quick_pow(x,n, mod):
    ans= 1
    while n:
        if n&1:
            ans *= x
            ans %= mod
        x *= x
        x %= mod
        n >>= 1
    
    return ans


def solve():
    mod = 1000000007
    n = f()[0]

    dirs = {}

    all0 = 0
    x0 = 0
    y0 = 0

    for _ in range(n):
        a,b = f()
        if a ==0 and b == 0:
            all0 += 1
            continue
        if a == 0:
            x0 += 1
            continue
        if b == 0:
            y0 += 1
            continue

        if a <0:
            a = -a
            b = -b
        g = gcd(abs(a),abs(b))
        a //= g
        b //= g

        if a*b >0:
            if (a,b) not in dirs:
                dirs[(a,b)] = {}
                dirs[(a,b)][0] = 0
                dirs[(a,b)][1] = 0
            dirs[(a,b)][0] = dirs[(a,b)][0]+ 1
        else:
            if (-b,a) not in dirs:
                dirs[(-b,a)] = {}
                dirs[(-b,a)][0] = 0
                dirs[(-b,a)][1] = 0
            dirs[(-b,a)][1] = dirs[(-b,a)][1] + 1 
            
    
    ans = 1
    ans *= (quick_pow(2, x0, mod) + quick_pow(2, y0, mod)-1 + mod) % mod

    
    ans %= mod
    for _, l in dirs.items():
        ans *= (quick_pow(2, l[0], mod) + quick_pow(2, l[1], mod)-1 + mod)%mod
        ans %= mod

    
    ans -= 1
    if all0:
        ans+= all0
    
    ans += mod
    ans%= mod
    print(ans)
    

solve()



Measured memory_bytes: 92192
#include <stdio.h>

int main()
{
    // 入力用変数
    int N;
    int d[50];

    // 出力用変数
    int point = 0;

    // 入力処理
    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        scanf("%d", &d[i]);
    }

    // 計算
    for (int i = 0; i < N-1; i++) {
        for (int j = i+1; j < N; j++) {
            point += d[i] * d[j];
        }
    }

    // 出力処理
    printf("%d\n", point);

    return 0;
}

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

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

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

/**
 * @brief 多次元 vector の作成
 * @author えびちゃん
 */
namespace detail {
    template<typename T, int N>
    auto make_vec(vector<int>& sizes, T const& x) {
        if constexpr (N == 1) {
            return vector(sizes[0], x);
        } else {
            int size = sizes[N-1];
            sizes.pop_back();
            return vector(size, make_vec<T, N-1>(sizes, x));
        }
    }
}
template<typename T, int N>
auto make_vec(int const(&sizes)[N], T const& x = T()) {
    vector<int> s(N);
    for (int i = 0; i < N; ++i) s[i] = sizes[N-i-1];
    return detail::make_vec<T, N>(s, x);
}

__attribute__((constructor))
void fast_io() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<pair<int, int>> a;
    a.emplace_back(s[0] - '0', 0);
    rep(i, n) {
        if (a.back().first == s[i] - '0') a.back().second++;
        else a.emplace_back(s[i] - '0', 1);
    }

    int m = a.size();
    int ans = 0;
    int r = 0;
    int now = 0;
    int zero = 0;
    for (int l = 0; l < m; ++l) {
        while (r < m && zero + (a[r].first == 0) <= k) {
            now += a[r].second;
            zero += (a[r].first == 0);
            r++;
        }
        chmax(ans, now);
        now -= a[l].second;
        zero -= (a[l].first == 0);
    }

    cout << ans << '\n';
}


Measured memory_bytes: 4536
#pythonの標準入力はちょっとややこしいので
#https://qiita.com/kyuna/items/8ee8916c2f4e36321a1c
#この辺を参考にするとよいかも

s = input()
t = input()

#あとは同じ
ans = 0

#len(s)はsの長さを表す
for i in range(len(s)):
    if (s[i] != t[i]):
        #pythonでは++は使えない
        ans = ans + 1
print(ans)


Measured memory_bytes: 9460
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.StringTokenizer;

public class Main {

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

		solve(sc,out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out) {
		String s = sc.next();
		String str = "CODEFESTIVAL2016";
		
		int res = 0;
		for(int i = 0; i < 16; i++) {
			if(s.charAt(i) != str.charAt(i)) res++;
		}
		out.println(res);
	}

	public static int gcd(int a, int b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}

	public static long gcd(long a, long b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}

	public static int lcm(int a, int b) {
		return a / gcd(a, b) * b;
	}
	
	public static long lcm(long a, long b) {
		return a / gcd(a, b) * b;
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(final K key, final V value) {
        super(key, value);
    }

    public Pair<V, K> swap() {
    	return new Pair<V, K>(getValue(), getKey());
    }
 }

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
     }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 21204
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>

using namespace std;
using ll = long long;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double PI = 4.0 * atan(1.0);

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, a, n) for (int i = a; i <= (n); ++i)

int main() {
    int N; cin >> N;
    int tmp = (N + 1) / 2;
    double ans = (double) tmp / N;

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


Measured memory_bytes: 256
import itertools
import sys
input = sys.stdin.readline

def prime_boolean_table(n):
    primes = [True] * (n + 1)
    primes[0] = False
    primes[1] = False
    for i in range(2, n + 1):
        if primes[i]:
            for j in range(i + i, n + 1, i):
                primes[j] = False
    return primes

def main():
    pl = prime_boolean_table(10**5)
    ql = [0]*(10**5+1)
    for i in range(1,10**5+1):
        if pl[i] and pl[(i+1)//2]:
            ql[i] += 1
    ql = list(itertools.accumulate(ql))
    q = int(input())
    for _ in range(q):
        l,r = map(int,input().split())
        print(ql[r]-ql[l-1])

if __name__=='__main__':
    main()

Measured memory_bytes: 7716
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cmath>         // abs
typedef long long ll;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mod 1000000007
#define fst first
#define pb push_back

int main()
{  
    int H,W;
    cin >> H >> W;
    vector<vector<char>> g(H+2, vector<char>(W+2));
    for(int i = 0; i < H+2; i++)
    {
        for(int j = 0; j < W+2; j++)
        {
            g[i][j] = '#';
        }
    }
    for (int i = 1; i <= H; i++)
    {
        for (int j = 1; j <= W; j++)
        {
            cin >> g[i][j];
        }
    }
    for (int i = 0; i < H + 2; i++)
    {
        for (int j = 0; j < W + 2; j++)
        {
            cout << g[i][j];
        }
        cout << endl;
    }
    cout << endl;
}


Measured memory_bytes: 384
#include<stdio.h>
int main(void){
 char s[4];
  int a=0,b=0,c=0;
  scanf("%s",s);
  if(s[0]=='R') a=1;
  if(s[1]=='R') b=1;
  if(s[2]=='R') c=1;
  if(a+b+c==1) printf("1");
  if(b==0&&a+b+c==2) printf("1");
  if(a+b+c==2&&b==1) printf("2");
  if(a==1&&b==1&&c==1) printf("3");
  if(a==0&&b==0&&c==0) printf("0");
  return 0;
}

Measured memory_bytes: 1632
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}





char x;

signed main(){
	cin>>x;
	printf("%c",x+1);
}

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

int main()
{
	int a=0,b,c,d,sum=0;
	string s;
    cin>>s;
    
	while(a<s.size())
    {
        if(s[a]=='A' ||s[a]=='C' || s[a]=='G' || s[a]=='T')
        {
            int cnt=1;
            for(int b=a+1;;b++)
            {
                

                    if(s[b]=='A' ||s[b]=='C' || s[b]=='G' || s[b]=='T')
                {
                    cnt++;
                }
                else
                {
                    break;
                }

                
            }
            if(cnt>sum)
                    sum=cnt;
        }
        a++;
    }
	cout<<sum;
	return 0;
}
	

Measured memory_bytes: 256
import math
N = int(input())
T = [0]*110000
X = [0]*110000
Y = [0]*110000

for n in range(N):
    T[n+1], X[n+1], Y[n+1] = map(int, input().split())

res = True
for n in range(N):
    dt   = T[n+1] - T[n]
    dist = abs(X[n+1] - X[n]) + abs(Y[n+1] - Y[n])
    if dt < dist:
        res = False
    if dt % 2 != dist % 2:
        res = False

if res:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 11892
/* ****mittal21**** */
#include<bits/stdc++.h>
#define ll          long long int 
#define ld          long double
#define pb          push_back
#define endl        '\n'
#define pii         pair<long long int,long long int>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll )x.size()
#define hell        998244353
#define jell        998244353
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repr(i,a,b)   for(ll int i=a;i>=b;i--)
#define lbnd    lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define DEC(N)  cout << std::fixed; cout << setprecision(N);
using namespace std;
#define N  200005
ll dp[N],pre[N];
void solve()
{
   ll n,k;
   cin>>n>>k;
   std::vector<pair<ll,ll>> v;
   for(int i=1;i<=k;i++)
   {
         ll l,r;
         cin>>l>>r;
         v.pb({l,r});
   }
   pre[1]=1;
   for(int i=2;i<=n;i++)
   {
       ll cnt=0;
       for(int j=0;j<k;j++)
       {
            cnt=(cnt+pre[max(0LL,i-v[j].F)]-pre[max(0LL,i-v[j].S-1)])%hell;
       }
       pre[i]=(pre[i-1]+cnt)%hell;
      // cout<<cnt<<endl;
   }
   cout<<(pre[n]-pre[n-1]+hell)%hell;
   
   return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll testcase=1;
    //cin>>testcase;
    while(testcase--)
    {
        solve();
    }
    return 0;
}

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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
const  LL mod=1000000007;
vector<int>v[11];
int n,d;
int mp[1000009];
bool f(int i,int j)
{
    LL x=0;
    for(int k=0; k<d; k++)
    {
        x+=(v[i][k]-v[j][k])* (v[i][k]-v[j][k]);
    }
    if(mp[x])
        return true;
    return false;
}
int main()
{
    cin>>n>>d;
    for(LL i=0;i<=1000;i++)
    {
        mp[i*i]=1;
    }
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<d; j++)
        {
            int x;
            cin>>x;
            v[i].pb(x);
        }
    }
    int cnt=0;
    for(int i=0; i<n; i++)
    {
        for(int j=i+1; j<n; j++)
        {
            if(f(i,j))
                cnt++;
        }
    }
    cout<<cnt;

}


Measured memory_bytes: 6576
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	boolean[] students = new boolean[30];
	int n = 0;

	while(sc.hasNext()){
	    n = sc.nextInt();
	    students[n-1] = true;
	}
	
	for(int i = 0;i<30;i++){
	    if(students[i]!=true){ System.out.println(i+1); }
	}
    }
}

Measured memory_bytes: 17188
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define LL long long 
#define LD long double
map<string,int>mp;
string s[55],k;
int n;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		cin>>s[i];
		cin>>mp[s[i]];
	}
	cin>>k;
	for(int i=1;i<=n;i++)
		if(k==s[i])
		{
			LL ans=0;
			for(int j=i+1;j<=n;j++)
				ans+=mp[s[j]];
			cout<<ans<<endl;
			return 0;
		}
	cout<<0<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <deque>
#include <queue>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <set>
#define INF 1000000000000
#define MOD 1000000007
using namespace std;
using ll = long long;
bool is_prime(const unsigned n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: return true;
    }

    // n > 2 が保証された

    for(unsigned i=2;i<n;++i){
        if(n%i == 0) return false;
    }

    return true;
}

int main() {
    ll n;
    cin >> n;
    ll ans = 1;
    vector<ll> prime(1000000,1);
    for(ll i=1;i<=n;i++){
        for(ll j=2;j<=i;j++){
            ll temp = i;
            if(is_prime(j)){
                while(true){
                    if(temp%j==0){
                        prime[j]++;
                        temp = temp/j;
                    }else{
                        break;
                    }
                }
            }
        }
    }
    for(ll i=0;i<1000000;i++){
        ans=ans*prime[i];
        ans = ans%MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const ll INF=2e15;
const double PI=acos(-1);


map<ll,int> prime_factor(ll n) {
    map<ll,int> res;
    repr(i,2,sqrt(n)+1) {
        while (n%i==0) {
            ++res[i];
            n/=i;
        }
    }
    if(n!=1) ++res[n];
    return res;
}


int main() {
    ios_base::sync_with_stdio(false); 

    ll n;
    cin >> n;
    vector<int> cnt(1010);
    rep(i,n) {
        map<ll,int> pf=prime_factor(i+1);
        repitr(itr,pf) cnt[itr->first]+=itr->second;
    }
    ll ans=1;
    rep(i,1010) ans=(ans*(cnt[i]+1))%MOD;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
using namespace std;
#define MAXSIZE 200
#define MAXL 100
typedef long long int lli;

int getDigitSum(int x);

int getAbs(int x);

int getMin(vector<int> v);

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

    int numOdd = 0;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        numOdd += (a % 2 == 1);
    }
    string ans = (numOdd % 2 == 0)? "YES" : "NO";
    cout << ans << endl;
    return 0;
}

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

int getAbs(int x){
    return (x > 0)? x : -x;
}

int getMin(vector<int> v){
    int res = 40000;
    for(int i = 0; i < v.size(); i++){
        res = min(res, v[i]);
    }
    return res;
}

Measured memory_bytes: 256
from itertools import permutations

n, m = map(int, input().split())

g = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)

ans = 0
for perm in permutations(range(1, n), n-1):
    s = 0
    flag = True
    for p in perm:
        if p not in g[s]:
            flag = False
            break
        s = p
    if flag:
        ans += 1
print(ans)


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

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

  // ２文字連続をはじく
  for (int i = 0; i < text.size() - 1; i++)
  {
    if (text[i] == text[i + 1])
    {
      cout << i + 1 << ' ' << i + 2 << endl;
      return 0;
    }
  }

  // ３文字中２文字をはじく
  for (int i = 0; i < text.size() - 2; i++)
  {
    if (text[i] == text[i + 2])
    {
      cout << i + 1 << ' ' << i + 3 << endl;
      return 0;
    }
  }

  // バランス
  cout << -1 << ' ' << -1 << endl;
}

Measured memory_bytes: 3756
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
using namespace std;
//union find木(グループわけができる)
int par[200005];
int unifind(int n) {
	for (int i = 1; i <= n; i++) {
		par[i] = i;
	}
	return 0;
}
//木の根を求める
int unifind_root(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = unifind_root(par[x]);
	}
}
//同じグループか判定
bool unifind_same(int x, int y) {
	return unifind_root(x) == unifind_root(y);
}
//グループ併合
int unifind_unite(int x, int y) {
	x = unifind_root(x);
	y = unifind_root(y);
	if (x == y) {
		return 0;
	}
	par[x] = y;
}

int main() {
	map<long long int, long long int>mp;
	//cout << fixed << setprecision(10);
	long long int n,u[200000],v[200000],w[200000];
	long double x=0;
	string str, str2;
	cin >> n ;
	unifind(2*n);
	for (int i = 1; i <= n-1; i++) {
		cin >> u[i]>>v[i]>>w[i];
		if (w[i]%2 == 0) {
			unifind_unite(u[i], v[i]);
			unifind_unite(u[i]+n, v[i]+n);
		}
		else {
			unifind_unite(u[i], v[i]+n);
			unifind_unite(u[i]+n, v[i] );
		}
	}
	for (int i = 1; i <= n; i++) {
		if (unifind_root(1) == unifind_root(i)) {
			cout << 0 << endl;
		}
		else {
			cout << 1 << endl;
		}
	}
}


Measured memory_bytes: 5632
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define Maxn 100005
typedef long long ll;
int n,tot;
int hea[Maxn],ds[Maxn];
int ver[Maxn*2],nex[Maxn*2],edg[Maxn*2];
void add(int u,int v,int d)
{
	 ver[++tot]=v,edg[tot]=d,nex[tot]=hea[u],hea[u]=tot;
}
struct ren
{
	 int num;
	 int Cost;
	 friend bool operator < (ren x,ren y)
	 {
	 	 return x.Cost>y.Cost;
	 }
}cur,vis;
priority_queue<ren> q;
int dj()
{
	 memset(ds,inf,sizeof(ds));
	 cur.num=1,cur.Cost=0;
	 q.push(cur);
	 ds[1]=0;
	 while(!q.empty())
	 {
	 	 cur=q.top();
	 	 q.pop();
	 	 for(int i=hea[cur.num];i;i=nex[i])
	 	 {
	 	 	 if(ds[cur.num]+edg[i]<ds[ver[i]])
	 	 	 {
	 	 	 	 ds[ver[i]]=ds[cur.num]+edg[i];
	 	 	 	 vis.num=ver[i],vis.Cost=ds[ver[i]];
	 	 	 	 q.push(vis);
			 }
		 }
	 }
	 return ds[0]+1;
}
int main()
{
     //freopen("","r",stdin);
     //freopen("","w",stdout);
	 scanf("%d",&n);
	 for(int i=0;i<n;i++)
	 {
	 	 add(i,(i+1)%n,1);
	 	 add(i,(i*10)%n,0);
	 }
	 printf("%d\n",dj());
     //fclose(stdin);
     //fclose(stdout);
     return 0;
}

Measured memory_bytes: 3964
#include <bits/stdc++.h>
using namespace std;
int main() {
	string s; cin >> s;
	int n = s.size();
	map<int, int> m;
	for(int i=0;i<n;i++){
		int k = s[i]-'a';
		m[k]++;
		if(m[k]>1 || s=="zyxwvutsrqponmlkjihgfedcba"){
			cout << -1 << endl;
			return 0;
		}
	}
	for(char c ='a';c<='z';c++){
		if(m[c-'a']==0){
			cout << s << c << endl;
			return 0;
		}
	}
	int t = 0;
	if(n==26){
		for(int i=n-1;i>=1;i--){
			int x = s[i]-'a';
			int y = s[i-1]-'a';
			if(x<y){
				m[x]++;
				continue;
			}
			if(x>y){
				m[x]++;
				for(char c='a';c<='z';c++){
					if(m[c-'a']==2 && s[i-1]<c){
						s[i-1] = c;
						//cout << c << endl;
						break;
					}
				}
				t = i;
				break;
			}
		}
	}
	for(int i=0;i<t;i++){
		cout << s[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 998244353;
 
// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
const int biggg = 1000000000;
const long eps = .0000000001;


int main ()
{
  prep();
  double r;
  cin >> r;
  cout << 2*r*pi;
  return 0;
}


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

using namespace std;
#define ll long long

/*int main()
{
    int n;
    ll sum=0;
    cin >> n;
    for(int i=0; i<n; i++) {
        ll a;
        cin >> a;
        sum+=a;
    }
    if(sum%2==0) {
        cout << "second" << endl;
    }
    else {
        cout << "first" << endl;
    }
    return 0;
}
*/
int main(){
    int N;
    cin>>N;
    int a[N];
    int k=0;
    for(int i=0;i<N;i++){
        cin>>a[i];
        if(a[i]%2==1){
            k++;
        }
    }
    if(k>0){
        cout<<"first"<<endl;
    }else{
        cout<<"second"<<endl;
    }
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for( int i=a; i<b; i++ )
#define REP(i,n) rep(i,0,n)
#define INF 1000000000000
using lli = long long int;
using ulli = unsigned long long int;
typedef pair<lli,int> P;

struct edge{ int u, v; lli cost; };
struct DirectedGraph
{
  int vertex_num;
  int edge_num;
  vector<edge> edge_list;
  vector< vector<int> > adj_list;
	vector< vector<lli> > distance_matrix;
};

template <typename T>
vector<int> argsort(const vector<T> &v) {

  // initialize original index locations
  vector<int> idx(v.size());
  iota(idx.begin(), idx.end(), 0);

  // sort indexes based on comparing values in v
  sort(idx.begin(), idx.end(),
       [&v](int i1, int i2) {return v[i1] < v[i2];});

  return idx;
}

template<typename T>
void displayVector(vector<T> v)
{
	lli n = v.size();
	REP(i,n){
		cout << v[i] << " " ;
	}
	cout << endl;
}


int main(){
	int N; cin >> N;
	vector<lli> a(N);
	REP(i,N){ cin >> a[i]; }

	vector<int> sorted_index = argsort(a);
	vector<lli> b = a;
	sort(a.begin(), a.end() );
	lli left = a[N/2-1]; lli right = a[N/2];
	
	REP(i, N){
		if( b[i] <= left){ cout << right << endl; }
		else{ cout << left << endl; }
	}
	return 0;
}

Measured memory_bytes: 7112
import sys

input = sys.stdin.readline
sys.setrecursionlimit(100000)
mod = 10 ** 9 + 7
# mod = 998244353


def read_values():
    return map(int, input().split())


def read_index():
    return map(lambda x: int(x) - 1, input().split())


def read_list():
    return list(read_values())


def read_lists(N):
    return [read_list() for n in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v

    def __str__(self):
        return str(self.v)

    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n)


def main():
    N = int(input())
    P = read_list()
    A = [N * k + 1 for k in range(N)]
    B = A[::-1]

    for i, p in enumerate(P):
        A[p - 1] += i

    print(" ".join(map(str, A)))
    print(" ".join(map(str, B)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 7204
import sys
from heapq import heappush,heappop

n, m = map(int, sys.stdin.readline().split())
d = [[] for _ in range(m+1)]
for i in range(n):
    a, b = map(int, sys.stdin.readline().split())
    if a <= m:
        d[a].append(b)

res = 0
resList = []
for i in range(1, m+1):
    if len(d[i]) > 0:
        for j in d[i]:
            heappush(resList, -j)
    if len(resList) > 0:
        res += (-1) * resList[0]
        heappop(resList)

print(res)


Measured memory_bytes: 62000
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); } bool DEBUG = 0; 
void log(A ...)(lazy A a){ if(DEBUG) print(a); }
void print(){ writeln(""); } void print(T)(T t){ writeln(t); } void print(T, A ...)(T t, A a){ write(t, " "), print(a); }
string unsplit(T)(T xs){ return xs.array.to!(string[]).join(" "); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; } T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
T lowerTo(T)(ref T x, T y){ if(x > y) x = y; return x; } T raiseTo(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
  int n = scan!int;
  int m = scan!int;
  int[] as = scan!int(m);
  
  int[] odds, evens;
  foreach(a; as) if(a % 2) odds ~= a; else evens ~= a;
  
  if(odds.length > 2){
    "Impossible".writeln;
    return;
  }
  
  int[] ans, bns;
  if(odds.length == 0){
    ans = evens;
    foreach(a; evens) bns ~= a;
    bns[0] -= 1;
    bns ~= 1;
  }
  else if(odds.length == 1){
    if(odds[0] == 1){
      ans = [1] ~ evens;
      bns = evens ~ 1;
    }
    else{
      ans = odds ~ evens;
      bns = [odds[0] - 1] ~ evens ~ 1;
    }
  }
  else if(odds.length == 2){
    if(odds[0] == 1){
      ans = [1] ~ evens ~ odds[1];
      bns = evens ~ (odds[1] + 1);
    }
    else{
      ans = [odds[0]] ~ evens ~ odds[1];
      bns = [odds[0] - 1] ~ evens ~ (odds[1] + 1);
    }
  }
  
  print(ans.unsplit);
  print(bns.length);
  print(bns.unsplit);
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        int b;
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        b=1;
        for(int i=0;i<3;i++){
            b*=a;
        };
        System.out.println(b);
    }
}

Measured memory_bytes: 26372
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair

const int N = 100100;
int n;
vector<int> g[N];
int col[N];

bool dfs(int v) {
	for (int u : g[v]) {
		if (col[u] != -1) {
			if (col[v] == col[u]) return false;
		} else {
			col[u] = col[v] ^ 1;
			if (!dfs(u)) return false;
		}
	}
	return true;
}

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int m;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++) {
		int v, u;
		scanf("%d%d", &v, &u);
		v--;u--;
		g[v].push_back(u);
		g[u].push_back(v);
	}
	for (int i = 0; i < n; i++)
		col[i] = -1;
	col[0] = 0;
	ll ans = 0;
	if (!dfs(0))
		ans = (ll)n * (n - 1) / 2;
	else {
		ans = 0;
		for (int i = 0; i < n; i++)
			ans += col[i];
		ans *= n - ans;
	}
	ans -= m;
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 6400
using System;
using System.Collections.Generic;
using System.Linq;

class Progaram
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine().ToCharArray();

        var r = 0L; var g = 0L; var b = 0L;

        for (var i = 0; n > i; i++)
        {
            if (s[i] == 'R') r++;
            else if (s[i] == 'G') g++;
            else b++;
        }

        var res = r * g * b;

        for (var i = 0; n > i; i++)
        {
            for (var j = i + 1; n > j; j++)
            {
                var k = (j + 1) * 2 - (i + 1); // <= j - i = k - jを変形
                if (k - 1 < n && s[i] != s[j] && s[k - 1] != s[j] && s[i] != s[k - 1]) res--;
            }
        }
        Console.WriteLine(res);
    }
}

Measured memory_bytes: 27544
#include <iostream>
#include <set>
#include <string>
using namespace std;

int main() {
	string S;
	cin >> S;
	set<char> a;
	for (char& i : S) a.insert(i);
	char i;
	for (i = 'a'; i <= 'z'; ++i) {
		if (!a.count(i)) break;
	}
	if ('z' < i) cout << "None";
	else cout << i;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

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

void dfs(vector<int> A)
{
	if (A.size() == n+1) {


		int now = 0;
		rep(i, q)
		{
			if (A[b[i]] - A[a[i]] == c[i]) now += d[i];
		}
		ans = max(ans, now);
		return;
	}

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

int main()
{
	cin >> n >> m >> q;
	a = b = c = d = vector<int>(q);

	rep(i, q)
	{
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}
	dfs(vector<int>(1, 1));
	cout << ans << endl;

	return 0;
}

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

int main() {
  int N;
  cin >> N;
  int result = 1000000000;
  
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    
    int j = 0;
    while(A % 2 != 1){
      A /= 2;
      j++;
    }
    if (result > j) result = j;
  }
  cout << result << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int H[300], W[300];
	int i=0,j=0;
	int n, m;
	while (1) {
		scanf("%d %d", &H[i], &W[i]);
		if (H[i] == 0 && W[i] == 0) break;
		i++;
	}
	while (i > j) {
		for (n = 0;n < H[j];n++) {
			for (m = 0;m < W[j];m++) {
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
		j++;
	}
	return 0;
}


Measured memory_bytes: 2148
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)
//std::sort(v.begin(), v.end(), std::greater<Type>());


ll N,A,B,C,D,E;

int main(){
  cin >> N >> A  >> B >> C >> D >> E;
  ll mi = min(min(min(min(A,B),C),D),E);
  if(mi>=N) cout<< 5 <<endl;
  else cout<< (N+mi-1)/mi+4 <<endl;

}


Measured memory_bytes: 256
S = list(input())

C = []
F = []
for i, s in enumerate(S):
    if s == "C":
        C.append(i)
    elif s == "F":
        F.append(i)

if len(C) > 0 and len(F):
    if min(C) < max(F):
        print('Yes')
    else:
        print('No')
else:
    print('No')


Measured memory_bytes: 2940
n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(m)]
a.sort(key=lambda x:x[1])
ans = 0
x=-1
for i in range(m):
    if a[i][0]>x:
        x=a[i][1]-1
        ans +=1
print(ans)

Measured memory_bytes: 29084
package main

import (
	"fmt"
	"math"
)

func isL2sqrInt(x1, x2 *[]int) bool {
	distance2 := 0
	for i, v := range *x1 {
		distance2 += (v - (*x2)[i]) * (v - (*x2)[i])
	}
	distance := math.Sqrt(float64(distance2))
	return distance2 == int(distance) * int(distance)
}

func solve() {
	var N int
	var D int
	fmt.Scan(&N, &D)
	X := make([][]int, N)
	for i := 0; i < N; i++ {
		X[i] = make([]int, D)
		for j := 0; j < D; j++ {
			fmt.Scan(&X[i][j])
		}
	}

	ans := 0
	for i := 0; i < N; i++ {
		for j := i+1; j < N; j++ {
			ans += map[bool]int{true: 1, false: 0}[isL2sqrInt(&X[i], &X[j])]
		}
	}
	fmt.Println(ans)
}

func main() {
	solve()
}

Measured memory_bytes: 512
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e10;
const long double PI = (acos(-1));

string dream = "maerd";
string dreamer = "remaerd";
string erase = "esare";
string eraser = "resare";

signed main() {
	int N;
	cin >> N;
	vector<int>A(N);
	set<int>s;
	rep(i, N) {
		cin >> A[i];
		s.insert(A[i]);
	}
	int a = N - s.size();
	int b = (a + 2 - 1) / 2;
	int ans = N - b * 2;
	cout << ans << endl;
}

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

int main(){
   int N , sum = 0, Ntmp;
   cin >> N;
   Ntmp = N;

    while(true){
        sum += Ntmp%10;
        Ntmp /= 10;
        if(Ntmp == 0) break;
    }
    if(N % sum == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main()
{
    int a,b;
    char op;
    scanf("%d %c %d",&a, &op, &b);
    
    if(op == '-')
    {
        printf("%d",a-b);
    }
    else
    {
        printf("%d",a+b);
    }
}


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

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

int main() {
  int a, b;
  string s;
  cin >> a >> b >> s;
  bool flag = true;
  rep(i, s.size()) {
    if (i == a)
      flag &= (s[i] == '-');
    else
      flag &= isdigit(s[i]);
  }
  cout << (flag ? "Yes" : "No") << endl;
  return 0;
}


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

void solve(){
  int n; cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  int cnt = 0;
  for(int i = 0; i < n; i++){
    int minj = i;
    for(int j = i + 1; j < n; j++){
      if(a[j] < a[minj]){
        minj = j;
      }
    }
    if(minj == i) continue;
    cnt++;
    int t = a[i];
    a[i] = a[minj];
    a[minj] = t;
  }
  for(int i = 0; i < n - 1; i++){
    cout << a[i] << " ";
  }
  cout << a[n - 1] << endl;
  cout << cnt << endl;
  return;
}

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



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

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> v(h);
  for(int i = 0; i < h; ++i)
    cin >> v[i];
  vector<bool> row(h, false);
  vector<bool> col(w, false);
  for(int i = 0; i < h; ++i) {
    for(int j = 0; j < w; ++j) {
      if(v[i][j] == '#') {
        row[i] = true;
        col[j] = true;
      }
    }
  }
  for(int i = 0; i < h; ++i) {
    if(row[i]) {
      for(int j = 0; j < w; ++j)
        if(col[j])
          cout << v[i][j];
      cout << endl;
    }
  }
  return 0;
}

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

ll a[212345];

int main(){
	int n; ll k; scanf("%d%lld", &n, &k);
	REP(i, n) scanf("%lld", a+i);
	ll mi = 0, mx = 1'000'000'007; //mi->ng mx->ok
	while(mx-mi>1){
		ll md = (mi+mx)/2, sm = 0;
		REP(i, n) sm += (a[i] - 1) / md;
		if(sm <= k) mx = md;
		else mi = md;
	}
	printf("%lld\n", mx);
}


Measured memory_bytes: 5292
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> &P){
os << P.first;
os << " ";
os << P.second;
os << "\n";
return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
//fixed<<setprecision(10)<<ans<<endl;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;
    cin >> s >> t;
    int lens = s.size(), lent = t.size();
    vector<vector<int>> dp(lens+1,vector<int>(lent+1));
    int ans=0;
    REP(i,lens+1) dp[i][0]=i;
    REP(i,lent+1) dp[0][i]=i;
    REP(i,lens){
        REP(j,lent){
            dp[i+1][j+1]=min(dp[i][j+1]+1,dp[i+1][j]+1);
            if(s[i]==t[j]) chmin(dp[i+1][j+1], dp[i][j]);
            else chmin(dp[i+1][j+1], dp[i][j]+1);
        }
    }    
    ans = dp[lens][lent];
    cout << ans << endl;
}


Measured memory_bytes: 10720
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cassert>


#define M 1000000007
#define S 200000

typedef unsigned long long ull;


std::vector<ull> fac(S);
std::vector<ull> ifac(S);

ull pow_mod(ull x, ull n) {
    ull ans = 1;
    while (n != 0) {
        if (n & 1) {
            ans = ans * x % M;
        }
        x = x * x % M;
        n = n >> 1;
    }
    return ans;
}

ull comb_mod(ull a, ull b) {
    // printf("a=%lld b=%lld\n", a, b);
    assert(a > 0 && b >= 0 && a >= b);
    ull tmp = ifac[a-b] * ifac[b] % M;
    return tmp * fac[a] % M;
}

void init_fac() {
    fac[0] = 1;
    ifac[0] = 1;
    for (int i = 1; i < S; i++) {
        fac[i] = fac[i-1] * i % M;
        ifac[i] = ifac[i-1] * pow_mod(i, M-2) % M;
    }
}

int main(int argc, char const *argv[])
{
    init_fac();

    int H, W, A, B;
    std::cin >> H >> W >> A >> B;

    ull ans = 0;
    for (int i = 0; i < H-A; i++) {
        ull before, after;
        if (B == 1) {
            before = 1;
        } else {
            before = comb_mod(i + B-1, i);
        }
        after = comb_mod(H-i-1 + W-B-1, H-i-1);
        // printf("before=%lld (%d %d)  after=%lld (%d %d)\n", before, i, B-1, after, H-i-1, W-B-1);
        ans = (ans + before * after) % M;

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


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

int main() {
    string S, T;
    cin >> S >> T;
    int l = S.length();
    int cnt = 0;
    rep(i,l) {
        if(S.at(i) != T.at(i)) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3916
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

struct edge{int to, cap, rev;};

vector<vector<edge>> g(10001);
vector<bool> used(10001);

void add_edge(int from, int to, int cap){
	g[from].push_back({to,cap,int(g[to].size())});
	g[to].push_back({from,0,int(g[from].size()-1)});
}
 
int dfs(int v,int t,int f){
	if(v==t) return f;
	used[v]=true;
	for(auto &e:g[v]){
		if(!used[e.to] && e.cap>0){
			int d=dfs(e.to,t,min(f,e.cap));
			if(d>0){
				e.cap-=d;
				g[e.to][e.rev].cap+=d;
				return d;
			}
		}
	}
	return 0;
}
 
int max_flow(int s,int t){
	int flow=0;
	for(;;){
        rep(i,used.size()) used[i]=false;
		int f=dfs(s,t,INF);
		if(f==0) return flow;
		flow+=f;
	}
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int V,e;
    cin>>V>>e;
    rep(i,e){
        int u,v,c;
        cin>>u>>v>>c;
        add_edge(u,v,c);
    }
    cout<<max_flow(0,V-1)<<endl;
}


Measured memory_bytes: 3364