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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main(){
    string s,t;
    cin >> s >> t;
    string tes;
    bool flag;
    int num = s.size()-t.size();
    REP(i,num+1){
        flag = true;
        tes = s.substr(num-i,t.size());
        REP(j,t.size()){
            if(tes[j]!=t[j]&&tes[j]!='?')flag = false;
        }
        if(flag){
            for(int k=0;k<s.size();){
                if(k==num-i){
                    cout << t;
                    k += t.size();
                }
                else{
                    if(s[k]=='?') cout << 'a';
                    else cout << s[k];
                    k++;
                }
            }
        cout << '\n';
        return 0;
        }
    }
    COUT("UNRESTORABLE");
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            {
                String t = findDiverseEnding(s, s.length() + 1);
                if (t != null) {
                    out.println(t);
                    return;
                }
            }
            for (int i = s.length() - 1; i >= 0; --i) {
                for (int ch = s.charAt(i) + 1; ch <= 'z'; ++ch) {
                    String t = s.substring(0, i) + (char) ch;
                    t = findDiverseEnding(t, t.length());
                    if (t != null) {
                        out.println(t);
                        return;
                    }
                }
            }
            if (s.length() < 26) {
                String t = "";
                for (int i = 0; i <= s.length(); ++i) {
                    t += (char) ('a' + i);
                }
                out.println(t);
            } else {
                out.println(-1);
            }
        }

        private String findDiverseEnding(String s, int length) {
            int[] cnt = new int[26];
            for (char ch : s.toCharArray()) ++cnt[ch - 'a'];
            for (int x : cnt) if (x >= 2) return null;
            for (int i = 0; i < 26 && s.length() < length; ++i)
                if (cnt[i] == 0) {
                    s += (char) ('a' + i);
                }
            if (s.length() < length) return null;
            return s;
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

    }
}



Measured memory_bytes: 23380
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      int a, b, c ,d;
      cin >> a >> b >> c >> d;
     
      int s = 2;
      while(true){
       if(s%2 == 0){
         c -= b;
       }else{
         a -= d;
       }
        s += 1;
       if(a<=0){
         cout << "No";
     
         return 0;
        }else if(c <= 0){
         cout << "Yes";
         return 0;
        }
      }
     
    }

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

using namespace std;

typedef double ll;

ll cal(vector<pair<ll, ll>> &points, vector<int> &perm){
    ll tot = 0;
    for(int i = 1; i < perm.size(); i++)
        tot += sqrt((points[perm[i]].first - points[perm[i-1]].first)*(points[perm[i]].first - points[perm[i-1]].first) + (points[perm[i]].second - points[perm[i-1]].second)*(points[perm[i]].second - points[perm[i-1]].second));
    return tot;
}

int main(){

    int n;
    cin >> n;
    vector<pair<ll, ll>> points(n);
    vector<int> perm(n);
    for(int i = 0; i < n; i++){
        cin >> points[i].first >> points[i].second;
        perm[i] = i;
    }
    
    ll sm = cal(points, perm);
    int cnt = 1;
    while(next_permutation(perm.begin(), perm.end())){
        sm += cal(points, perm);
        cnt++;
    }

    cout << setprecision(15) << ( sm/cnt ) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        for(int i = 1; i < 10; i++){
            for(int j = 1; j < 10; j++){
                System.out.printf("%dx%d=%d\n", i,j,i*j);
            }
        }
    }
}

Measured memory_bytes: 24800
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        long power = 1;
        for(int i = 1; i <= N;i++)
        {
            power *= i;
            power %= 1000000007;
        }
        Console.WriteLine(power);
    }
   
}


Measured memory_bytes: 11092
package main

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

type MyScanner struct {
	sc *bufio.Scanner
}

type MyWriter struct {
	stdout io.Writer
}

type MyPut interface{}

func getScanner(fp io.Reader) *bufio.Scanner {
	sc := bufio.NewScanner(fp)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 500001), 500000)
	return sc
}

func getHugeScanner(fp io.Reader, size int) *bufio.Scanner {
	sc := bufio.NewScanner(fp)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, size), size)
	return sc
}

func (mysc *MyScanner)String() string {
	mysc.sc.Scan()
	return mysc.sc.Text()
}

func (mysc *MyScanner)Int() int {
	i, _ := strconv.Atoi(mysc.String())
	return i
}

func (mysc *MyScanner)Int64() int64 {
	i, _ := strconv.ParseInt(mysc.String(), 10, 64)
	return i
}

func (mysc *MyScanner)Float64() float64 {
	i, _ := strconv.ParseFloat(mysc.String(), 64)
	return i
}

func (mw MyWriter)Puts(v MyPut) {
	_, _ = fmt.Fprintf(mw.stdout, "%v\n", v)
}

func Solve(stdin io.Reader, stdout io.Writer) {
	sc := MyScanner{getScanner(stdin)}
	mw := MyWriter{stdout}

	n := sc.Int()
	a := make([]int, n)
	b := make([]int, n)
	c := make([]int, n - 1)

	for i := 0; i < n; i++ {
		a[i] = sc.Int()
		a[i]--
	}

	for i := 0; i < n; i++ {
		b[i] = sc.Int()
	}

	for i := 0; i < n - 1; i++ {
		c[i] = sc.Int()
	}

	ans := 0

	for i := 0; i < n; i++ {
		ans += b[a[i]]
		if i < n - 1 && a[i] + 1 == a[i + 1] {
			ans += c[a[i]]
		}
	}

	mw.Puts(ans)
}

func main() {
	Solve(os.Stdin, os.Stdout)
	return
}

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

#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

#if __cplusplus >= 201402L
#include <shared_mutex>
#endif

using namespace std;

const int N = 205;
const int MOD = 998244353;

int x[N], y[N];

long P[N];

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d %d", x + i, y + i);
    }

    P[0] = 1;
    for (int i = 1; i <= n; ++i) {
        P[i] = P[i - 1] << 1;
        if (P[i] >= MOD) P[i] -= MOD;
    }

    long res = (P[n] - 1 - n + MOD) % MOD;
    for (int i = 0; i < n - 1; ++ i) {
        for (int j = i + 1; j < n; ++ j) {
            int count = 0;
            for (int k = j + 1; k < n; ++ k) {
                if ((x[k] - x[i]) * (y[j] - y[i]) == (y[k] - y[i]) * (x[j] - x[i])) {
                    count ++;
                }
            }
            res = (res - P[count] + MOD) % MOD;
        }
    }
    printf("%ld\n", res);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

int main() {
    ll n,k;
    cin >> n >> k;

    int a[n];
    int ccc[200005] = {};
    rep(i,n){
        cin >> a[i];
        ccc[a[i]]++;
    }
    int count[200005];
    
    int next[200005];
    int first[200005];
    rep(i,200005){
        next[i] = -1;
        first[i] = -1;
    }

    rep(i,200005){count[i] = -1;}

    rep(i,n){
        if(count[a[i]] == -1){
            count[a[i]] = i;
            next[i] = i;
            first[a[i]] = i;
        }else{
            next[count[a[i]]] = i;
            count[a[i]] = i;
            next[i] = -999;
        }
    }

    rep(i,n){
        if(next[i]==-999){
            next[i] = first[a[i]];
        }
    }

    /*
    int head[200005][2];
    int tale[200005][2];
    rep(i,200005){
        rep(j,2){
            head[i][j] = -777;
            tale[i][j] = -777;
        }
    }

    int ddd[200005] = {};

    rep(i,n){
        if(ccc[a[i]]>=4){
            if(ddd[a[i]]==0){
                head[a[i]][0] = i;
            }else if(ddd[a[i]]==1){
                head[a[i]][1] = i;
            }else if(ddd[a[i]]==ccc[a[i]]-2){
                tale[a[i]][0] = i;
            }else if(ddd[a[i]]==ccc[a[i]]-1){
                tale[a[i]][1] = i;
            }
        }
        ddd[a[i]]++;
    }
    */


    ll now = 0;


    while(true){
        ll tmp = now;
        int x = a[now%n];


        if(next[now%n]==now%n){
            now += n;
            now++;
        }else if(next[now%n]>now%n){
            now += (next[now%n]-now%n);
            now++;
        }else{
            now += (n+next[now%n]-now%n);
            now++;
        }


        if(now>=n*k-1){
            now = tmp;
            break;
        }else{
            if(now%n==0){
                ll loop = now;
                now += (((n*k-1)-now)/loop)*loop;
            }
        }
    }

    

    int ans[n+100] = {};
    int c = 0;

    while(true){
        if(now >= n*k)break;
        int x = a[now%n];
        if(next[now%n]==now%n){
            if(n*k-1<now+n){
                cout << x << ' ';
                now++;
            }else{
                now = now + n;
                now++;
            }
        }else if(next[now%n]>now%n){
            if(n*k-1<now + (next[now%n]-now%n)){
                cout << x << ' ';
                now++;
            }else{
                now += (next[now%n]-now%n);
                now++;
            }
        }else{
            if(n*k-1<now + (n+next[now%n]-now%n)){
                cout << x << ' ';
                now++;
            }else{
                now += (n+next[now%n]-now%n);
                now++;
            }
        }
    }

    
    cout << endl;
    return 0;
}
 
 


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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// テーブルを作る前処理
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        ll num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

vector<int> enum_div(int n)
{
	std::vector<int> ret;
	for(int i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}

int n;
ll dp[100005][13];

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

    dp[0][0] = 1;
    for (int i = 0; i < s.size(); i++) {
        int c;
        if (s[i] == '?') c = -1;
        else c = s[i] - '0';

        for (int j = 0; j < 10; j++) {
            if (c != -1 && c != j) continue;
            for (int ki = 0; ki < 13; ki++) {
                addM(dp[i + 1][(ki * 10 + j) % 13],dp[i][ki]);
            }
        }
    }

    pl(dp[s.size()][5])

    return 0;    
}


Measured memory_bytes: 10752
#-*-coding:utf-8-*-
import itertools

def main():
    n = int(input())
    name_list = []

    for i in range(n):
        name = input()
        if name[0] in ['M', 'A', 'R', 'C', 'H']:
            name_list.append(name[0])
    
    name_set = set(name_list)
    if len(name_set) <= 2:
        combi = 0
    else:
        name_combi = list(itertools.combinations(name_set, 3))
        combi = 0
        for i in name_combi:
            combi += name_list.count(i[0]) * name_list.count(i[1]) * name_list.count(i[2])
    
    print(combi)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3888
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll n;
    cin >> n;
    /*vector<ll> x(n);
    vector<ll> y(n);
    vector<ll> xpy(n);
    vector<ll> xmy(n);*/
    ll xpymax=-INFINITY;
    ll xpymin=INFINITY;
    ll xmymax=-INFINITY;
    ll xmymin=INFINITY;
    for(ll i=0;i<n;i++){
        ll x,y;
        cin >> x >> y;
        xpymax = max(xpymax,x+y);
        xpymin = min(xpymin,x+y);
        xmymax = max(xmymax,x-y);
        xmymin = min(xmymin,x-y);
    }
    cout << max(xpymax-xpymin,xmymax-xmymin);
}


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

using namespace std;

#define pb push_back
#define fi first
#define se second
#define all(vec) vec.begin(),vec.end()
#define f(i,a,b) for(int i=a;i<b;i++)
#define SZ(x) (int)x.size()

typedef  vector<string> vs;
typedef  vector<int> vi;


int main(){
	
	int n;

	cin >> n;
	
	string s;
	
	vs st;
	
	set<string> se;
	
	f(i,0,n){
	
		cin >> s; 
		
		st.pb(s);
		
		if(i>0){
			if(st[i-1].back()!=st[i].front()){
				cout << "No" << endl;
				return 0;
			}
		}
			
		
	}
	
	f(i,0,n){
		se.insert(st[i]);
	}
	
	if(SZ(se)==n){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	
 return 0;
}


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();
        sc.nextLine();
        
        int[][] grd = new int[k*2+1][k*2+1];
        
        for(int i=0; i<n; i++){
            String[] xyc = sc.nextLine().split(" ");
            int x = Integer.parseInt(xyc[0]);
            int y = Integer.parseInt(xyc[1]);
            if(xyc[2].charAt(0) == 'W'){
                y += k;
            }
            grd[y%(k*2)+1][x%(k*2)+1] += 1;
        }
        
        /*
        for(int i=0; i<k*2; i++){
            for(int j=0; j<k*2; j++){
                System.out.print(grd[i][j]);
            }
            System.out.println("");
        }
        */
        
        for(int i=0; i<k*2+1; i++){
            for(int j=0; j<k*2; j++){
                grd[i][j+1] += grd[i][j];
            }
        }
        
        for(int i=0; i<k*2; i++){
            for(int j=0; j<k*2+1; j++){
                grd[i+1][j] += grd[i][j];
            }
        }
        
        int all = grd[k*2][k*2];
        int ans = 0;
        for(int i=0; i<k; i++){
            for(int j=0; j<k; j++){
                int cnt = 0;
                //iki jkj
                cnt += njrisum(grd, i, j, k, k);
                //i0 j0
                cnt += njrisum(grd, 0, 0, i, j);
                //k2i j0
                cnt += njrisum(grd, i+k, 0, k-i, j);
                //i0 k2j
                cnt += njrisum(grd, 0, j+k, i, k-j);
                //k2i k2j
                cnt += njrisum(grd, i+k, j+k, k-i, k-j);
                
                if(ans < cnt) ans = cnt;
                if(ans < all - cnt) ans = all - cnt;
            }
        }
        
        System.out.println(ans);
    }
    
    public static int njrisum(int[][]grd, int i, int j, int h, int w){
        if(h==0 || w==0){
            return 0;
        }
        return grd[i + h][j + w] - grd[i][j + w] - grd[i + h][j] + grd[i][j];
    }
}


Measured memory_bytes: 153600
import queue

K = int(input())

q = queue.Queue()
ans = []
cnt = 0
for i in range(1,10):
    q.put(i)
    ans.append(i)
    cnt += 1

while cnt <= 10**5:
    n = q.get()
    m = n %10
    if m == 0:
        q.put(n*10+0)
        q.put(n*10+1)
        ans.append(n*10)
        ans.append(n*10+1)
        cnt += 1
    elif m == 9:
        q.put(n*10+8)
        q.put(n*10+9)
        ans.append(n*10+8)
        ans.append(n*10+9)
        cnt += 2
    else:
        q.put(n*10+m-1)
        q.put(n*10+m)
        q.put(n*10+m+1)
        ans.append(n*10+m-1)
        ans.append(n*10+m)
        ans.append(n*10+m+1)
        cnt += 3

print(ans[K-1])

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

N,T=map(int, input().split())
val=[list(map(int, input().split())) for i in range(N)]

#import sys
#input = sys.stdin.readline
#val = list(input()) #abc
#val=np.array(val)
#index=np.argsort(val[:,0])
#A=val[index,0].tolist()
#B=val[index,1].tolist()
val.sort()
A=[v[0] for v in val]
B=[v[1] for v in val]

#temp=np.zeros((T+1,N))
#Ts=T*np.ones(N-1)
#jun=np.arange(1,N)
#for itemp in range(T):
#    i=itemp
#    if i>=A[0]:
#        temp[i,0]=B[0]
#    if i>0:
#        temp[i,:]=np.amax([temp[i,:],temp[i-1,:]],0)
#    for jtemp in range(N-1):
#        j=jtemp+1
#        temp[i,j]=max(temp[i,j],temp[i,j-1])
#    jnext=np.amin([Ts,i+A[1:]],0)
#    jnext=[int(s) for s in jnext]
#    temp[jnext,jun]=np.amax([temp[i,:-1]+B[1:],temp[jnext,jun]],0)

temp=[[0]*N for i in range(T+1)]

for itemp in range(T):
    i=itemp
    if i>=A[0]:
        temp[i][0]=B[0]
    for jtemp in range(N-1):
        j=jtemp+1
        jbfo=temp[i][j-1]
        ijnow=temp[i][j]
        
        if i>0:
            temp[i][j]=max(ijnow,temp[i-1][j])
            
        temp[i][j]=max(ijnow,jbfo)
        if A[j]<T-i:
            temp[i+A[j]][j]=max(jbfo+B[j],temp[i+A[j]][j])
        else:
            temp[T][j]=max(jbfo+B[j],temp[T][j])
print(int(max(temp[-1][:]))) 

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

// See debug.cc for usage etc
#define DEBUG 0

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#if DEBUG
  #define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
  #define DCALL(func, ...) func(__VA_ARGS__)
#else
  #define DLOG(...)
  #define DCALL(func, ...)
#endif

constexpr ll maxH = 2000;
ll H, W;
vector<string> S(maxH);
vector<ll> p(maxH);

ll countDot(string s, ll pos) {
  ll r = s.find('#', pos);
  if (r == (ll)string::npos) {
    return s.size() - pos;
  }else {
    return r - pos;
  }
}

int main() {
#if !DEBUG
  ios_base::sync_with_stdio(false);
#endif

  cin >> H >> W;
  for (int i = 0; i < H; i++) {
    cin >> S.at(i);
    p.at(i) = -1;
  }
  ll ans = 0;
  for (int x = 0; x < W; x++) {
    DLOG("x = %d", x);
    int vlen = -1;
    for (int y = 0; y < H; y++) {
      DLOG("y = %d", y);
      if (S.at(y).at(x) == '#') {
	vlen = -1;
	p.at(y) = -1;
	continue;
      }
      if (vlen < 0) {
	vlen = 1;
	for (int j = y+1; j < H; j++) {
	  if (S.at(j).at(x) == '.')  vlen++;
	  else  break;
	}
      }
      if (p.at(y) < 0) {
	p.at(y) = countDot(S.at(y), x);
      }
      ll val = vlen + p.at(y) - 1;
      DLOG("val = %lld, vlen = %d, p.at(%d) = %lld", val, vlen, y, p.at(y));
      ans = max(ans, val);
    }
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 4608
import java.util.Scanner;

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


        for(int i=1; i<=9; i++) {
            for(int j=1; j<=9; j++) {
                if(n == i*j) {
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        }
        System.out.println("No");
    }
}


Measured memory_bytes: 35996
x1,y1,x2,y2 = map(int,input().split())
x3 = x2 - (y2 - y1)
y3 = y2 + (x2 - x1)
x4 = x1 - (y2 - y1)
y4 = y1 + (x2 - x1)
print(x3, y3, x4, y4)

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

int main() {
    
	int n;
	cin >> n;
	int par[n+1];
	for (int i=1; i<=n; i++) {
		int x;
		cin >> x;
		par[i] = x;
	}
	int curr = 1;
	for (int i=0; i<n*3; i++) {
		if (curr == 2) {
			cout << i << endl;
			exit(0);
		}
		curr = par[curr];
	}
	cout << -1 << endl;
    
}


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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 105


int X,N,P[maxn];
bool taken[maxn];

int main(){
	fast;
	
	cin>>X>>N;
	
	FOR(i,1,N){
		cin>>P[i];
		taken[P[i]] = 1;
	}
	
	int cur = X;
	while (cur >= 0 && taken[cur]) cur--;
	int cur2 = X;
	while (taken[cur2]) cur2++;
	
	if (abs(cur - X) <= abs(cur2 - X)) cout<<cur;
	else cout<<cur2;
	
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<long double> a(n);
    REP(i,n) {
        long double tmp; cin >> tmp;
        a[i] = 1/tmp;
    }
    long double ans = 1/accumulate(ALL(a), 0.000);
    cout <<  setprecision(6) << ans << endl;
    return 0;
}

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

int main(){
  char str[1000002];
  while(cin >> str){
    static int a[3][1000001];
    int ans = 0;

    int size;
    for(size=0;str[size]!='\0';size++);

    for(int i=0;i<3;i++) for(int j=0;j<size;j++) a[i][j] = 0;
    if(str[0] == 'J') a[0][0] = 1;
    else if(str[0] == 'O') a[1][0] = 1;
    else if(str[0] == 'I') a[2][0] = 1;

    for(int i=1;i<size;i++){
      if(str[i] == 'J') a[0][i] = a[0][i-1] + 1;
      else if(str[i] == 'O') a[1][i] = a[1][i-1] + 1;
      else if(str[i] == 'I') a[2][i] = a[2][i-1] + 1;
    }

    for(int i=0;i<size-2;i++){
      if(a[0][i] > 0 && a[0][i+1] == 0){
	int c = a[0][i];
	if(a[1][i+1] == 0) continue;
	i++;
	for(;i<size;i++){
	  if(a[1][i] > 0 && a[1][i+1] == 0){
	    if(a[1][i] > c) break;
	    c = a[1][i];
	    i++;
	    int c2 = i;
	    for(;i<size;i++) if(a[2][i] == 0) break;
	    if(i-c2 < c){
	      i--;
	      break;
	    }
	    ans = max(ans,c);
	    i--;
	    break;
	  }
	}
      }
    }

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

Measured memory_bytes: 13000
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;++i)
#define repi(i,n) for(ll i=n-1;i>=0;--i)
#define sll(n) scanf("%lld", &n);
#define slf(n) scanf("%lf", &n);
typedef long long ll;
typedef double lf;
static const ll max_n = 130;
static const ll mod = 1000000007;
static const ll max_value = 100000000000100;

ll N, M;


void Main(){
    // bool is_ok = true;
    // printf("------------- V=%lld---------\n", V);
    ll X;
    sll(X);
    
    for(ll A=-max_n;A<=max_n;A++){
        ll pow_a = A*A*A*A*A;
        // printf("pow_a:%lld\n", pow_a);
        bool is_find = false;
        for(ll B=-max_n;B<=max_n;B++){
            ll pow_b = B * B * B * B * B;
            if(X == pow_a - pow_b){
                printf("%lld %lld\n", A, B);
                is_find = true;
                break;
            }
        }
        if(is_find){
            break;
        }
    }

    // printf("%lld\n", ans);


    // cout<<fixed<<setprecision(10)<<num<<endl;
    // cout << num << endl;

}

int main(){
    Main();

    return 0;

}

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

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

  while (true) {
    int i;
    for (i = 2; i * i <= x; i++) {
      if (x % i == 0) break;
    }
    if (i * i > x) break;
    x++;
  }
  cout << x << endl;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
nums = list(map(int, input().split()))
def judge(n, k, nums):
  original = nums
  types = set(nums)
  diff = len(types) - k
  count = []
  temp_count = 0
  temp_char = nums[0]
  ans = 0
  nums.sort()

  if len(types) <= k:
    return 0

  for i in range(n):
    if nums[i] == temp_char:
      temp_count += 1
    else:
      temp_char = nums[i]
      if not temp_count == 0:
        count.append(temp_count)
      temp_count = 1

    if i == n-1:
      if not temp_count == 0:
        count.append(temp_count)
        
  count.sort()
  
  return sum(count[:diff])

print(judge(n, k, nums))

Measured memory_bytes: 25276
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<cmath>
using namespace std;

int main()
{
    char a[5];
    while(cin>>a)
    {
        int f = 0, f1 = 0, f2 = 0;
        for(int i = 0; i < 3; i ++)
        {
            if(a[i] == 'a')f=1;
            else if(a[i] == 'b')f1 = 1;
            else f2 = 1;
        }
        if(f&&f1&&f2)printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}


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 p[] =new int[n];
    
    for(int i = 0; i < n; ++i){
      p[i] = sc.nextInt();
    }
    
    int count = 0;
    
    for(int i = 1; i < n-1; ++i){
      if(p[i-1]<p[i] && p[i]<p[i+1]){
        count +=1;
      }else if(p[i-1]>p[i] && p[i]>p[i+1]){
        count +=1;
      }
    }
    
    System.out.println(count);

  }
}

Measured memory_bytes: 35696
#include <iostream>
#include <algorithm>

using namespace std;

int main(void) {
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;

    int cost_without_ab = x*a + y*b;
    int full_ab = 2*c*max(x, y);
    int cost = min(cost_without_ab, full_ab);

    int num_ab =  2 * min(x, y);
    int cost_ab = num_ab * c;
    if (x > y) 
        cost_ab += (x - num_ab/2) * a;
    else
        cost_ab += (y - num_ab/2) * b;
    cost = min(cost, cost_ab);
    cout << cost << endl;
}


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

int ch[4];

int main(){
	std::string str;
	std::cin >> str;

	for (int i = 0; i < str.size(); ++i){
		if (str[i] == 'K')++ch[0];
		if (str[i] == 'U')++ch[1];
		if (str[i] == 'P')++ch[2];
		if (str[i] == 'C')++ch[3];
	}

	std::cout << *std::min_element(ch, ch + 4) << std::endl;

	return 0;
}

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

int main() {
	string s; cin>> s;
	set<string> stal,ststr;
	for(int i=0; i<s.size();++i){
		ststr.insert(s.substr(i,1));
	}
	for (char moji='a';moji<='z';++moji){
		string str= {moji};
		stal.insert(str);
	}
	set<string> diff;
	set_difference(stal.begin(),stal.end(),ststr.begin(),ststr.end(),inserter(diff, diff.end()));
	if (diff.size()>0){
		cout << *diff.begin() << endl;
	} else {
		cout << "None" << endl;
	}
	return 0;
}

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


int main(){
  long mod=1e9+7,n,w;
  cin>>n>>w;
  char a[n][w];
  for (long i=0;i<n;i++)
     for (long j=0;j<w;j++)
        cin>>a[i][j];
  long m[n][w];
  
  for (long i=0;i<n;i++){
     for (long j=0;j<w;j++){
         if (i==0&&j==0)
         m[i][j]=1;
         else if ((i==0||j==0)&&a[i][j]=='.'){
           if (!i)
           m[i][j]=m[i][j-1];
           if(!j)
           m[i][j]=m[i-1][j];
         }
         else if ((i==0||j==0))
           m[i][j]=0;
         else if (a[i][j]=='.')
           m[i][j]=(m[i-1][j]+m[i][j-1])%mod;
         else
           m[i][j]=0;
     }
  }
  cout<<m[n-1][w-1]<<endl;
return 0;  
}

Measured memory_bytes: 9088
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#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)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;

using namespace std;


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

  int ans = 0;
  vector<vector<int>> dp(N+1, vector<int>(N+1));
  RREP(i, N){
    RREP(j, N){
      if(s[i] != s[j]) dp[i][j] = 0;
      else dp[i][j] = min(dp[i+1][j+1]+1, j-i);
      chmax(ans, dp[i][j]);
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 195840
import java.util.*;

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

        for(int i=1;i<S.length();i++){
            if(S.charAt(i) != S.charAt(i-1)){
                count++;
            }
        }
        System.out.println(count);
    }
}

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s,t,u;
  int a,b;
  cin>>s>>t>>a>>b>>u;
  if(s==u){
    a--;
  }
  else{
    b--;
  }
  cout<<a<<' '<<b;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define vi vector <int>
#define vl vector <ll>
#define dl pair <ll, ll>
#define ii pair <ll, ll>
#define vii vector <ii>
#define graph vector <vector <int> >
#define REP(a, b) for (int i = a; i < b; i++)
#define REP2(a, b) for (int j = a; j < b; j++)
#define REPS(a, b, c) for (int i = a; i < b; i += c)
#define mod 1000000007

using namespace std;
 
int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
 
    ll n;
    cin >> n;
    ll suma = 0;
    REP(1, n) {
    	suma += (n / i - (n % i == 0));
    }
    cout << suma << endl;
    return 0;
}

Measured memory_bytes: 3688
N = gets.to_i
A = gets.strip
B = gets.strip
C = gets.strip

count = 0

N.times{|i|
	a = A[i]
	b = B[i]
	c = C[i]
	
	chars = [a, b, c].sort.uniq
	
	if chars.length == 3
		count += 2
	elsif chars.length == 2
		count += 1
	end
	
}

puts count


Measured memory_bytes: 1788
/********************************************************
  **░██████╗██╗░░░░░░█████╗░██╗░░░██╗██╗░█████╗░░██████╗░**
  **██╔════╝██║░░░░░██╔══██╗██║░░░██║██║██╔══██╗██╔════╝░**
  **╚█████╗░██║░░░░░███████║╚██╗░██╔╝██║██║░░╚═╝██║░░██╗░**
  **░╚═══██╗██║░░░░░██╔══██║░╚████╔╝░██║██║░░██╗██║░░╚██╗**
  **██████╔╝███████╗██║░░██║░░╚██╔╝░░██║╚█████╔╝╚██████╔╝**
  **╚═════╝░╚══════╝╚═╝░░╚═╝░░░╚═╝░░░╚═╝░╚════╝░░╚═════╝░**
  *********************************************************/
 
#include <bits/stdc++.h>
using namespace std;
 
 
#define ll                          long long
#define ld                          long double
 
#define forn(i,n)                   for(int i=0;i<n;++i)
#define all(v)                      v.begin(), v.end()
#define rall(v)                     v.rbegin(),v.rend()
#define isSubstring(s1,s2)          s1.find(s2) != std::string::npos
	
#define pb                          push_back
#define pf                          push_front
#define mp                          make_pair
#define fr                          first
#define sc                          second
 
#define vpi                         vector<pair<int,int>>
#define vi                          vector<int>
#define sz(a)                       (int)a.size()
 
#define   endl                       "\n"
#define     nl                       cout<<"\n";
#define fastio                       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 
#define  MN                           INT_MIN
#define  MX                           INT_MAX

bool isPrime(ll n){if(n<2)return false;for(ll x = 2;x*x <=n;x++){if(n%x == 0)return false;}return true;}
bool isPerfectSquare(long double x){long double sr=sqrt(x);return((sr-floor(sr))==0);}
int gcd(int a, int b){if(a==0)return b;if(b==0) return a;if(a==b)return a;if(a>b)return gcd(a-b,b);return gcd(a,b-a);}

int32_t main()
{
	int a ,b ,n;
	cin >>n >> a >> b;
	cout << min(n * a, b) << endl;
}

Measured memory_bytes: 3628
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    cin >> a >> b;
    if(a!=1 && b!=1){
        if(a>b)  cout << "Alice";
        else if(a<b) cout << "Bob";
        else cout << "Draw";
    }
    else {
        if(a == 1 && b != 1) cout << "Alice";
        else if(b == 1 && a != 1) cout << "Bob";
        else cout << "Draw";
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <cmath>
#include <map>
#include <set>
#include <assert.h>
#include <stdio.h>
#define REP(i,n) for(ll i=0;i<(n);i++)
#define MOD 1000000007
#define int long long
#ifdef int
const long long INF = LLONG_MAX / 10;
#else
const int INF = 1010101010;
#endif
using namespace std;
typedef long long ll;
typedef vector<vector<ll> > mat;
typedef pair<int, int> P;
//typedef pair<double, double> P;
const int dx[9] = {-1, 0, 0, 1, -1, -1, 1, 1, 0};
const int dy[9] = {0, -1, 1, 0, -1, 1, -1, 1, 0};
 
int N, K;
int a[101010];
int sum[101010];
int plussum[101010];
 
signed main()
{
  cin >> N >> K;
  REP(i,N) {
    cin >> a[i];
    sum[i+1] += sum[i] + a[i];
    plussum[i+1] += plussum[i] + (a[i] > 0 ? a[i] : 0);
  }

  // REP(i,N+1) {
  //   cout << plussum[i] << " ";
  // }

  int ans = 0;
  for (int i=0; i<=N-K; i++) {
    ans = max(ans, plussum[i] + (sum[i+K] - sum[i]) + (plussum[N] - plussum[i+K]));
    ans = max(ans, plussum[i] + (plussum[N] - plussum[i+K]));
  }
  cout << ans << endl;
}

Measured memory_bytes: 2560
// C
//#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/
 
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
 
#define INF INT_MAX/3
#define MAX_N 10000
bool dp[MAX_N+1][MAX_N+1];
int n[MAX_N+1];
void solve(){
   int m;
   int ans=0;
   cin>>m;
   //cin.sync_with_stdio(false);
   //int max=1;
  // cout<<m<<endl;
   rep(i,m){
    cin>>n[i];
   // cout<<n[i]<<endl;
    //if(max<n[i]) max=n[i];
//dp[i+1][n[i]]=true;
  //  if(dp[n[i]][i+1]==true) ans++;
   }
   rep(i,m){
    if(n[n[i]-1]==i+1) ans++;
   }
   cout<<ans/2<<endl;
}
int main(){
  solve();
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

const int maxn = 1e5+10;
vector<int> adj[maxn];
int memo[maxn];

int solve(int no){
	if(memo[no] != -1){
		return memo[no];
	}
	
	int ans = 0;
	for(int v : adj[no]){
		ans = max(ans, 1 + solve(v));
	}
	
	return memo[no] = ans;
}

int32_t main(){
	cin.tie(0); ios::sync_with_stdio(0);
	
	memset(memo, -1, sizeof memo);
	int n, m;
	cin >> n >> m;
	int a, b;
	for(int i = 0; i < m; i++){
		cin >> a >> b;
		adj[a].push_back(b);
	}
	
	int ans = 0;
	for(int i = 1; i <= n; i++){
		ans = max(ans, solve(i));
	}
	
	cout << ans << endl;
}


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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  
  int judge=0;
  if (s.at(0)!='A') judge=1;
  
  int existC=0,index;
  for (int i=2;i<n-1;i++) {
    if (s.at(i)=='C') {
      if (existC==0) {
        existC=1;
        index=i;
      }
      else {
        judge=1;
        break;
      }
    }
    if (i==n-2 && existC==0) judge=1;
  }
  
  for (int i=1;i<n;i++) {
    int x = s.at(i)-'B';
    if (s.at(i)!='C' && 0<=x && x<=24) {
      judge=1;
      break;
    }
  }
  
  if (judge==1) {
    cout << "WA";
  }
  else {
    cout << "AC";
  }
}

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

int main(){
  long long n;
  cin>>n;
  long double temp;
  map<pair<long long,long long>,long long>n25;
  for(int i=0;i<n;i++){
    cin>>temp;
    temp*=1000000000;
    long long ltemp=(long long)(temp+0.5);
    //cout<<setprecision(18)<<temp<<endl;
    //cout<<ltemp<<endl;
    long long n2=0;
    long long ltemptemp=ltemp;
    while(ltemptemp % 2 == 0){
      n2++;
      ltemptemp/= 2;
    }
    long long n5=0;
    while(ltemptemp % 5 == 0){
      n5++;
      ltemptemp/= 5;
    }
    n25[make_pair(n2,n5)]++;   
  }
  long long cnt=0;
  for(auto it=n25.begin();it !=n25.end();it++){
    for(auto jt=n25.begin();jt != n25.end();jt++){
      if(it->first.first+jt->first.first >= 18 && it->first.second+jt->first.second >= 18){
        if(it != jt){
          cnt+= (it->second * jt->second);
        }
        else{
          cnt+=(it->second)*(it->second-1);
        }
      }
    }
  }
  cout<<cnt/2<<endl;
  return 0;
}


Measured memory_bytes: 3764
#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define INF 2147483647
using namespace std;
using Graph=vector<vector<int>>;

int main(){
  int n,k; cin>>n>>k;
  int a[100][n];
  rep(i,n){
    cin>>a[0][i];
  }
  rep1(i,100){
    int tmpmax[n+1]={},tmpmin[n+1]={};
    rep(j,n){
      tmpmax[min(1+j+a[i-1][j],n)]++;
      tmpmin[max(1+j-a[i-1][j],1)]++;
    }
    a[i][0]=tmpmin[1];
    rep1(j,n){
      a[i][j]=a[i][j-1]+tmpmin[j+1]-tmpmax[j];
    }
  }
  rep(i,n){
    cout<<a[min(k,99)][i]<<" ";
  }
}


Measured memory_bytes: 83320
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 10 ** 9 + 7
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rf(): return float(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]
def rf_(): return [float(_) for _ in rs().split()]
def divisors(n, sortedresult=True):
    div = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            div.append(i)
            if i != n // i:
                div.append(n//i)
    if sortedresult:
        div.sort()
    return div
# endregion
a, b, c = ri_()
print('YES' if b - a == c - b else 'NO')

Measured memory_bytes: 63724
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  ll x, a, b;
  cin >> x >> a >> b;
  if(b-a <= 0) cout << "delicious" << endl;
  else if(b-a <= x) cout << "safe" << endl;
  else cout << "dangerous" << endl; 
  return 0;
}

Measured memory_bytes: 256