akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int D = sc.nextInt();
		int[][] x = new int[N][D];
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < D; j++) {
				x[i][j] = sc.nextInt();
			}
		}
		int ans = 0;
		for (int i = 0; i < N - 1; i++) {
			for (int j = i+1; j < N; j++) {
				double sum = 0;
				for (int k = 0; k < D; k++) {
					sum += Math.pow(x[i][k] - x[j][k], 2);
				}
				double temp = Math.sqrt(sum);
				if (temp == Math.floor(temp)) {
					ans++;
				}
			}
		}
		System.out.println(ans);
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

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

Measured memory_bytes: 23124
X,Y=gets.split.map(&:to_i)
cnt=0
cnt+=300000 if X==1
cnt+=200000 if X==2
cnt+=100000 if X==3
cnt+=300000 if Y==1
cnt+=200000 if Y==2
cnt+=100000 if Y==3
cnt+=400000 if X==1 && Y==1
puts cnt

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

int main(){
  int n;
  cin >> n;
  
  for(int i = 0; i < 3; ++i){
    if(n % 10 == 7){
      cout << "Yes" << endl;
      return 0;
    }
    n /= 10;
  }
  
  cout << "No" << endl;
}


Measured memory_bytes: 3592
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	n = int(input())
	#b , c = tin()
	#s = input()	
	pp_min=mod*mod
	pp_max=0
	pm_max=-mod*mod
	mp_max=-mod*mod
	for _ in range(n):
		a, b = tin()
		pp_min = min(pp_min, a+b)
		pp_max = max(pp_max, a+b)
		pm_max = max(pm_max, a-b)
		mp_max = max(mp_max, -a + b)
	return max((pp_max - pp_min), (mp_max + pm_max))
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 74460
use proconio::input;

fn main() {
    input! {
        n: isize,
        k: isize,
        p: [isize; n],
    };

    let mut p: Vec<isize> = p;
    p.sort();

    let mut total: isize = 0;

    for i in 0..k {
        total += p[i as usize];
    }

    println!("{}", total);
}


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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;

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

const int MAX = 1010000;
ll 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;
    }
}
ll modcomb(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;
}

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

    ll X,Y;
    string S;
    cin >> X>>Y;

    /*ll dp[1000001][1000001];

    dp[0][0] = 1;
    dp[1][0] = 1;
    dp[1][1] = 1;

    if(!((X+Y)%3==0)){
        cout << 0 << endl;
    }
    else {
        for (ll i = 2; i < N; i++)
        {
            for (ll j = 0; j < 3*i; j++)
            {
                dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j - 2];
            };
        }
    }*/
    /*if((X+Y)%3==0){
        int num = (X + Y) / 3;
        vector<vector<ll>> v(num + 1, vector<ll>(num + 1, 0));
        comb(v);
        
        cout << (v[num][max(X, Y) - num])%MOD  << endl;
    }
    else{
        cout << 0 << endl;
    }*/


    if((X+Y)%3==0){
        COMinit();
        ll a = (2 * X - Y) / 3;
        ll b = (2 * Y - X) / 3;
        //cout << a << " " << b << endl;
        cout << modcomb(a + b, a) << endl;
    }
    else{
        cout << 0 << endl;
    }
}


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const ll inf = 1e9;


void solve()
{
  ll N;
  scanf("%lld",&N);
  ll i;
  scanf("%lld",&i);
  cout << N-i+1 << endl;
}

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


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

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		Map<Long, Long> memo = new HashMap<>();
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			long n = in.nextLong();
			out.println(f(n) % MOD);

		}

		long f(long n) {

			long ret = 0;

			if (memo.containsKey(n)) {
				return memo.get(n);
			}
			if (n == 0) return 1;
			if (n == 1) return 2;

			ret = f(n/2) + f((n-1)/2) + f((n-2)/2) % MOD;

			memo.put(n, ret % MOD);

			return ret;
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

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

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

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

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

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep1(i, n) for(int i=1; i<(int)(n); i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> wi;

int gcd(int p, int q){
  if(p%q==0)return q;
  return gcd(q, p%q);
}

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

  int a, b;
  cin >> a >> b;
  ll c=(ll)a*(ll)b;

  cout << c/gcd(a, b) << endl;

  return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<=s.size()-1;i++)
	{
		for(int j=i+1;j<=s.size();j++)
		{
			if(s[j]==s[i])
			{
				cout<<"no";
				return 0;
			}
		}
	}
	cout<<"yes";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
double pi=acos(-1);
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
// #define mp make_pair
#define pq priority_queue
const ll mod=1000000007;
#define f first
#define s second
#define pii pair< ll, ll >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace boost::multiprecision;
using namespace std;
void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


const int N=1000005;
ll fact[N],invfact[N];
ll power(ll x,ll y){
  if(y<=0) return 1LL;
  ll z=power(x,y/2);
  if(y%2) return (((z*z)%mod)*x)%mod;
  return (z*z)%mod;
}
void pre(){
  fact[0]=invfact[0]=invfact[1]=fact[1]=1;
  rep(i,2,N) fact[i]=(i*fact[i-1])%mod;
  rep(i,2,N) invfact[i]=(invfact[i-1]*power(i,mod-2))%mod;
}
ll nCr(ll n,ll k){ return (((fact[n]*invfact[n-k])%mod)*invfact[k])%mod; }



const int N1=1e6+1;
vector<int> isprime(N1,1),prime;
void seive(){
  rep(i,2,sqrt(N1)+1){
      if(isprime[i]){
        for(int j=i*i;j<N1;j+=i) isprime[j]=0;
        prime.pb(i);
      }
  }
  rep(i,sqrt(N1)+1,N1) if(isprime[i]) prime.pb(i);
}



struct dsu {
    vector<int> par, rank;
    dsu(int n): par(n+1), rank(n+1) {
        for (int i = 0; i <= n; i++) {
            par[i] = i;
            rank[i]= 1;
        }
    }
    int root(int a) {
        if (a == par[a]) return a;
        return par[a] = root(par[a]);
    }
    void merge(int a, int b) {
        a = root(a);
        b = root(b);
        if (a == b) return;
        if (rank[a] > rank[b]) swap(a, b);
        par[b] = a;
    }
    set<int> parent(int n){
        set<int> s;
        for(int i=1;i<=n;i++){
            s.insert(root(i));
        }
        return s;
    }
};

void solve(){

  int n;
  cin>>n;
  vector<pii> a(n);
  rep(i,0,n) cin>>a[i].f>>a[i].s;
  int flag=0;
  rep(i,2,n) if(a[i-1].f==a[i-1].s && a[i-2].f==a[i-2].s &&  a[i].f==a[i].s) flag=1;
  if(flag) cout<<"Yes\n";
  else cout<<"No\n";
}

int main(){
    optimizeIO();
    {solve();}
}


Measured memory_bytes: 7016
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<climits>
#include<set>
#include<map>
#include<cmath>
#include<iomanip>
#include<iterator>
#include<queue>
#include<stack>
#include<cctype>
#include<deque>
#include<time.h>
#include<bitset>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<sstream>
#include<random>

//by Skeef79

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
#define pb push_back
#define en '\n'
#define for0(i,n) for(int i = 0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vec vector
#define pii pair<int,int>
#define pll pair<ll,ll>
#define what_is(x) cout<<#x<<" is "<<x<<en;

using namespace std;

const int INF = 2000000000;
const ll LINF = 2000000000000000000;

template<typename T> void print(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}

template<typename T> void print(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}

template<typename T> void print(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a[i].size(); j++)
			cout << a[i][j] << ' ';
		cout << en;
	}
}

template <typename T> void input(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cin >> a[i];
}

template<typename T> void input(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cin >> a[i];
}

template<typename T> void input(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
		for (int j = 0; j < a[i].size(); j++)
			cin >> a[i][j];
}

void solve()
{
	ll n, a, b;
	cin >> n >> a >> b;
	ll ans = n / (a + b)*a;
	ll t = n / (a + b);
	n -= t * (a + b);
	if (a <= n)
		ans += a;
	else
		ans += n;
	cout << ans;
}

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

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif

	int tst = 1;
	//cin >> tst;
	while (tst--)
		solve();

}

Measured memory_bytes: 888
#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>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
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;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = (int)1e9 + 7;
int add(int x, int y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
int sub(int x, int y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
int mult(int x, int y) {
	return ((ll)x * y) % MOD;
}
int div2(int x) {
	if (x & 1) x += MOD;
	return x / 2;
}

const int N = 3030;
int a[N];
int xs[N];
int n, m, k;
int b[N][2];
int c[N], d[N];
int ans;

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

	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		xs[i] = a[i];
	}
	sort(xs, xs + n);
	k = unique(xs, xs + n) - xs;
	for (int i = 0; i < n; i++)
		a[i] = lower_bound(xs, xs + k, a[i]) - xs;
	for (int i = 0; i < m; i++)
		for (int j = 0; j < 2; j++) {
			scanf("%d", &b[i][j]);
			b[i][j]--;
		}
	for (int it = k - 1; it >= 0; it--) {
		for (int i = 0; i < n; i++)
			c[i] = (int)(a[i] == it);
		for (int i = 0; i < m; i++) {
			int x = div2(add(c[b[i][0]], c[b[i][1]]));
			c[b[i][0]] = c[b[i][1]] = x;
		}
		int sum = 0;
		for (int i = 0; i < n; i++) {
			ans = add(ans, mult(sum, c[i]));
			ans = add(ans, div2(mult(c[i], d[i])));
			sum = add(sum, d[i]);
			d[i] = add(d[i], c[i]);
		}
	}
	for (int i = 0; i < m; i++) {
		ans = add(ans, ans);
	}
	printf("%d\n", ans);

	return 0;
}


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


int main() {

	string s;
	cin >> s;

	for(int i=0; i<s.size(); i++){
		if(i == 3){
			cout << 8;
		}else{
			cout << s.at(i);
		}
	}
	cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
using namespace std;

#define ll long long

ll MAX(ll a, ll b) {

	if (a > b)return a;
	else return b;

}

int main() {

	ll N, M;
	vector<ll> D, T;

	cin >> N;
	for (ll i = 0; i < N; i++) {

		ll tmp;
		cin >> tmp;
		D.push_back(tmp);

	}
	cin >> M;
	for (ll i = 0; i < M; i++) {

		ll tmp;
		cin >> tmp;
		T.push_back(tmp);

	}
	sort(D.begin(), D.end());
	sort(T.begin(), T.end());

	ll now = 0;
	for (ll i = 0; i < M; i++) {

		for (ll j = now; j < N; j++) {

			if (T[i] == D[j]) {

				now = j + 1;
				break;

			}
			if (T[i] < D[j] || j == N - 1) {

				cout << "NO" << endl;
				return 0;

			}

		}

	}

	cout << "YES" << endl;

	return 0;
}

Measured memory_bytes: 4848
N, K = map(int, input().split())
V = list(map(int, input().split()))

res = 0
for p in range(min(N, K) + 1):
    q = 0
    while p + q <= min(N, K):
        v = []
        cur = 0
        for i in range(p):
            v.append(V[i])
            cur += V[i]
        for i in range(q):
            v.append(V[N-1-i])
            cur += V[N-1-i]
        v.sort()
        for i in range(min(K-p-q, len(v))):
            if v[i] < 0:
                cur -= v[i]
        res = max(res, cur)
        q += 1

print(res)


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
using namespace std;
int n;
int color[2][1000][1000];
int db[2<<17];
int dx[]={1,1,-1,-1},dy[]={1,-1,1,-1};
void dfs(int x,int y,int d,int col,int c)
{
	color[c][x][y]=col;
	for(int i=0;i*i<=d;i++)
	{
		if(db[d-i*i]<0)continue;
		int j=db[d-i*i];
		for(int r=0;r<4;r++)
		{
			int tx=x+dx[r]*i,ty=y+dy[r]*j;
			if(tx<0||ty<0||tx>=2*n||ty>=2*n||color[c][tx][ty])continue;
			dfs(tx,ty,d,col==1?2:1,c);
		}
	}
}
main()
{
	cin>>n;
	for(int i=0;i<2<<17;i++)db[i]=-1;
	for(int i=0;i*i<2<<17;i++)db[i*i]=i;
	for(int i=0;i<2;i++)
	{
		int d;cin>>d;
		for(int x=0;x<2*n;x++)for(int y=0;y<2*n;y++)if(!color[i][x][y])dfs(x,y,d,1,i);
	}
	for(int i=1;i<=2;i++)for(int j=1;j<=2;j++)
	{
		vector<pair<int,int> >a;
		for(int x=0;x<2*n;x++)
		{
			for(int y=0;y<2*n;y++)
			{
				if(color[0][x][y]==i&&color[1][x][y]==j)a.push_back(make_pair(x,y));
				if(a.size()==n*n)
				{
					for(int i=0;i<n*n;i++)cout<<a[i].first<<" "<<a[i].second<<endl;
					return 0;
				}
			}
		}
	}
}


Measured memory_bytes: 38004
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
  vector<int> v;
  for (int i = 0; i < 10; i++) {
    int a;
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end(), greater<int>());
  for (int i = 0; i < 3; i++)
    cout << v.at(i) << endl;
}

Measured memory_bytes: 1212
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>

using namespace std;
using ll = long long;

int main(){
    string str;
    cin >> str;
    ll cnt=0,ans=0;
    for(int i=0;i<str.size();i++){
        if(str[i]!='A'&&str[i]!='C'&&str[i]!='G'&&str[i]!='T'){
            ans = max(ans,cnt);
            cnt=0;
        }
        else cnt++;
    }
    cout << max(ans,cnt);
	return 0;
}

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

using namespace std;
int main(){
	int k,a,b,q = 0;
    cin >> k;
    cin >> a >> b;
    for(int i = a ; i <= b; i++){
        if(i % k == 0)
        {
            cout << "OK";
            i = b+1;
            q = 1;
        }
    }
    if(q == 0)cout << "NG";
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>                                           
 
//#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb; 
typedef long long ll;  
typedef double db;                         
 
 
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, N = 3e3 + 48, mod = 1e9 + 7, maxn = 102;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;


int n, dp[N][N], pr[N][N];
string s;

void add (int &x, int y) {
	x += y;
	if (x >= mod)
		x -= mod;
}

int get (int l, int r, int tp) {
	if (l > r)
		return 0;
	return (dp[tp][r] - dp[tp][l - 1] + mod) % mod;
}

main () {
	cin >> n >> s;
	dp[1][1] = 1;
	
	s = "##" + s;
	forn (i, 2, sz(s) - 1)	
		forn (j, 1, i) {
			dp[i][j] = dp[i][j - 1];
			if (s[i] == '<') 
				add(dp[i][j], dp[i - 1][j - 1]);
			else
				add(dp[i][j], get(j, i - 1, i - 1));
		}

	
	cout << dp[n][n] << endl;
} 

Measured memory_bytes: 37504
n,m=map(int,input().split())
h=list(map(int,input().split()))
l=[1]*n
for i in range(m):
  a,b=map(int,input().split())
  if h[a-1]==h[b-1]:
    l[a-1]=0
    l[b-1]=0
  if h[a-1]>h[b-1]:
    l[b-1]=0
  if  h[a-1]<h[b-1]:
    l[a-1]=0
print(l.count(1))

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

const ll MAX = 1000000;
const ll MOD = 1000000007;

ll fac[MAX];

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

ll pow_kai(ll a,ll n){//aのn乗を計算します。
  ll x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = x*a%MOD;
    }
    a = a*a%MOD;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    ll tmp=1;
    for(ll i=n;i>=n-k+1;i--) tmp = (tmp*i)%MOD;

    return (tmp * pow_kai(fac[k],MOD-2)) % MOD;
}


int main()
{
    ll A,B,tax8,tax10;
    
    cin >> A >> B;

    ll ans=13;

    while(ans<=1001){
        tax8=ans*8/100;
        tax10=ans*10/100;
        if(tax8==A && tax10==B){
            cout << ans <<endl;
            return 0;
        }

        if(tax8>A || tax10>B){
            cout << -1 <<endl;
            return 0;
        }
        ans++;

    }

    cout << -1 << endl;

 
    return 0;

}

Measured memory_bytes: 256
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
template<typename T>void max_self(T &a,T b){a=max(a,b);}
template<typename T>void min_self(T &a,T b){a=min(a,b);}
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=4e5+10,oo=0x3f3f3f3f,MOD=1e9+7;
const long double PI = acos(-1),eps=1.0e-14;

void solve(){
    int n,k;
    cin>>n>>k;
    int arr[n];
    loop(n,i,0)
        cin>>arr[i];
    sort(all(arr,n));
    int res=1e9+1;
    loop(n-k+1,i,0){
        min_self(res,arr[i+k-1]-arr[i]);
    }
    cout<<res<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 4016
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <algorithm>
#include <string>
#include <set>
#include <iostream>
using namespace std;


set<string> used;

string gen(char start, char end) {
  string str;
  while (true) {
    str = "";
    str += start;
    for (int i = 0; i < 5; i++) {
      str += random() % 26 + 'a';
    }
    str += end;
    if (!used.count(str)) { break; }
  }
  return str;
}

string ask(const string out) {
  printf("?%s\n", out.c_str());
  fflush(stdout);

  string ret;
  cin >> ret;
  return ret;
}

void output(string str) {
  fprintf(stderr,"%s\n", str.c_str());
}


int main() {
  srandom(time(NULL));
  char prev = 'a';
  for (int i = 0; i < 51; i++) {
    string send, receive;
    send = gen(prev, 'a');
    used.insert(send);
    receive = ask(send);
    if (receive[0] != *send.rbegin()) { break; }
    if (used.count(receive)) { break; }
    used.insert(receive);
    prev = *receive.rbegin();
  }
  puts("!OUT");
  fflush(stdout);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using iii = pair<ii, int>;
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define __lcm(a, b) a * b / __gcd(a, b)
const int MOD = 1e9 + 7;
const int INF = 2e9;
const int N = 1e5 + 5;

int n;
int a[N], ans[N];

void solve() {
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        ans[a[i]] = i;
    }
    for(int i = 1; i <= n; i++) {
        cout << ans[i] << (i == n ? "\n" : " ");
    }
}

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

Measured memory_bytes: 4396
#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++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};


  
int main(){
  int n;
  cin>>n;
  if(n==1){
    cout<<1<<endl;
    return 0;
  }
  int a[n];
  int m;
  int s;
  //bool flag=false;
  vector<int> ms;
  REP(i,n){
    cin>>a[i];
  }
  REP(i,n){
    if(i==0){
      ms.push_back(a[i]);
      continue;
    }
    m = ms.size();
    if(ms[0]>=a[i]){
      auto it = ms.begin();
      ms.insert(it,a[i]);
    }else{
      int l=0,r=m;
      while(r-l>1){
        s = (l+r)/2;
        if(ms[s]<a[i]){
          l = s;
        }else{
          r = s;
        }
      }
      ms[l]=a[i];
    }
  }
  
  int ans = ms.size();
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1276
#include <iostream>
using namespace std;
int main() 
{
	int a,b;
    char op;
    while(1) {
    	cin >> a >> op >> b;
    	if(op=='?')
        		break;
	else if(op== '+') 
        		cout << a+b << endl;
    	else if(op== '-') 
        		cout << a-b << endl;
    	else if(op== '*') 
        		cout << a*b << endl;
    	else if(op== '/') 
    		cout << a/b << endl;
    }
	return 0;
}



Measured memory_bytes: 3076
import numpy as np
from itertools import combinations

N,D = map(int,input().split())

points = [np.array(list(map(int,input().split()))) for _ in range(N)]

cnt = 0
for p,q in combinations(points, 2):
    d = np.linalg.norm(p-q)
    if float(d) == int(d):
        cnt += 1

print(cnt)

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

namespace ARC068
{
    class D
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] A = Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray();
            int[] distinc_A = A.Distinct().OrderBy(x => x).ToArray();

            Dictionary<int, int> dict = new Dictionary<int, int>();
            for (int i = 0; i < N; i++)
            {
                if (!dict.ContainsKey(A[i])) dict.Add(A[i], 1);
                else dict[A[i]]++;
            }

            int even_count = 0;
            foreach (var i in distinc_A)
            {
                if (dict[i] % 2 == 0) { dict[i] = 2; even_count++; }
                else dict[i] = 1;
            }

            int res = 0;
            if (even_count % 2 == 0) res = distinc_A.Count();
            else res = distinc_A.Count() - 1;

            Console.WriteLine(res);
        }
    }
}


Measured memory_bytes: 25696
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
 *
 * @author anand.oza
 */
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);
        AAddition solver = new AAddition();
        solver.solve(1, in, out);
        out.close();
    }

    static class AAddition {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();

            int odd = 0, even = 0;

            for (int i = 0; i < n; i++) {
                int a = in.nextInt();
                if (a % 2 == 0) {
                    even++;
                } else {
                    odd++;
                }
            }

            String answer = odd % 2 == 0 ? "YES" : "NO";
            out.println(answer);
        }

    }

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

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

    }
}



Measured memory_bytes: 37848
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <deque>
#include <set>
using namespace std;
#define MOD 1000000007
#define MOD2 2000000014
#define LONG long long
long long kaizyo(int N);
long long P(int N, int M);
long long pow(int a, int n) {
	long long result = 1;
	for (int i = 0; i < n; i++) {
		result *= a;
		result = result % MOD;
	}
	return result;
}
int main()
{
	int N,M;
	cin >> N >> M;
	vector<int>A(M);
	vector<int>B(M);
	vector<int>mark(N);
	vector<int>count(N);

	for (int i = 0; i < N; i++) {
		mark[i] = i;
		count[i] = 1;
	}
	for(int i = 0; i < M; i++) {
		cin >> A[i] >> B[i];
		A[i]--;
		B[i]--;
	}
	for (int i = 0; i < M; i++) {
			int a = A[i];
			while (mark[a] != a) {
				a = mark[a];
			}
			int b = B[i];
			while (mark[b] !=b) {
				b = mark[b];
			}
			if (a == b) {
				continue;
			}


			int a1 = min(a, b);
			int a2 = max(a, b);
			mark[a2] = a1;
			count[a1] += count[a2];
			count[a2] = 0;

	}
	int result = 0;
	for (int i = 0; i < N; i++) {
		if (count[i] > result)
			result = count[i];
	}
	cout << result;

	



}
long long kaizyo(int N) {
	long long result = 1;
	for (int i = 2; i <= N; i++) {
		result *= i;
		result = result % MOD;
	}
	return result;
}
long long P(int N, int M) {
	long long result = 1;
	for (int i = (N - M + 1); i <= N; i++) {
		result *= i;
		result = result % MOD;
	}
	return result;
}


Measured memory_bytes: 6396
import java.util.Scanner;

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

        int n = scanner.nextInt();
        int[] x = new int[n];
        int sumX = 0;
        for (int i = 0; i < n; i++) {
            x[i] = scanner.nextInt();
            sumX += x[i];
        }
        int avg = Math.round((float) sumX / n);
        int result = 0;
        for (int i = 0; i < n; i++) {
            result += Math.pow(x[i] - avg, 2);
        }
        System.out.println(result);
    }
}

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

public class Main {

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

		int[] L = new int[N];
		for(int i=0; i<N; i++) {
			L[i] = scan.nextInt();
		}

		scan.close();
		
		Arrays.sort(L);
		
		int sum = 0;
		for(int i=0; i<N-1; i++) {
			sum +=L[i];
		}

		if(L[N-1]<sum) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 21844
#include <cstdio>

int main() {
  int a, b, n;
  scanf("%d %d %d", &a, &b, &n);

  for (int i = 1; i <= n; ++i) {
    int s, f;
    scanf("%d %d", &s, &f);

    if (b <= s || f <= a) continue;
    return puts("1"), 0;
  }
  puts("0");
}



Measured memory_bytes: 2684
#include<bits/stdc++.h>
using namespace std;
int GCD(int A,int B)
{
  if(!B)
    return A;
  return GCD(B,A%B);
}
int main()
{
  int K,Ans=0;
  cin>>K;
  for(int i=1;i<=K;i++)
    for(int j=1;j<=K;j++)
      for(int k=1;k<=K;k++)
        Ans+=GCD(GCD(i,j),k);
  cout<<Ans<<endl;
  return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;
public class Main
{
	public static void main( String args[] )
	{
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int m = input.nextInt();
		int[] s = new int[111];
		int[][] a = new int[111][111];
		int[] b = new int[111];
		for(int i = 0; i < n; i++)
			for(int k = 0; k < m; k++)
				a[i][k] = input.nextInt();
		for(int i = 0; i < m; i++)
			b[i] = input.nextInt();
		for (int i = 0; i < n; i++)
			for (int k = 0; k < m; k++)
			s[i] += a[i][k] * b[k];
		for(int i = 0; i < n; i++)
			System.out.println(s[i]);
	}
}

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

namespace TYC
{
	const int N = 2e5 + 5, INF = 0x3f3f3f3f;

	int n, s, t, Head[N], dep[N], cur[N], mat[N], from[N];
	pair<int, int> R[N];
	struct edge { int to, next, w; } E[N << 2];
	vector<int> Bel[N >> 1]; 

	inline void add(const int u, const int v)
	{
		static int ec = 1;
		E[++ec] = (edge){v, Head[u], 1};
		Head[u] = ec;
		E[++ec] = (edge){u, Head[v], 0};
		Head[v] = ec;
	}

	bool bfs()
	{
		memcpy(cur, Head, sizeof(int[t + 1]));
		memset(dep, 0, sizeof(int[t + 1]));
		static queue<int> q;
		q.push(s);
		dep[s] = 1;
		while (!q.empty())
		{
			int u = q.front();
			q.pop();
			for (int i = Head[u], v; i; i = E[i].next)
				if (E[i].w && !dep[v = E[i].to])
					dep[v] = dep[u] + 1, q.push(v);
		}
		return dep[t];
	}

	int dfs(const int u, const int mn)
	{
		if (u == t || !mn)
			return mn;
		int v, w, used = 0;
		for (int &i = cur[u]; i; i = E[i].next)
			if (E[i].w && dep[v = E[i].to] == dep[u] + 1)
			{
				w = dfs(v, min(mn - used, E[i].w));
				used += w;
				E[i].w -= w;
				E[i ^ 1].w += w;
				if (used == mn)
					return used;
			}
		if (!used)
			dep[u] = -1;
		return used;
	}

	int Dinic()
	{
		int ans = 0;
		while (bfs())
			ans += dfs(s, INF);
		return ans;
	}

	bool search()
	{
		static queue<int> q;
		q.push(n);
		from[n] = -1;
		int cnt = 0;
		while (!q.empty())
		{
			int x = q.front(), p;
			q.pop();
			cnt++;
			for (int i : Bel[x])
				if (!from[p = mat[i]])
				{
					R[i] = make_pair(x, p);
					from[p] = x;
					q.push(p);
				}
		}
		return cnt == n;
	}

	void work()
	{
		scanf("%d", &n);
		for (int i = 1, c, j; i < n; i++)
		{
			scanf("%d", &c);
			while (c--)
			{
				scanf("%d", &j);
				if (j != n)
					add(j, i + n);
				Bel[j].push_back(i);
			}
		}
		s = n + n, t = s + 1;
		for (int i = 1; i < n; i++)
			add(s, i), add(i + n, t);
		int flow = Dinic();
		if (flow != n - 1)
			puts("-1");
		else
		{
			for (int u = 1; u < n; u++)
				for (int i = Head[u + n]; i; i = E[i].next)
					if (E[i].w == 1 && E[i].to < n)
						mat[u] = E[i].to;
			if (!search())
				puts("-1");
			else
				for (int i = 1; i < n; i++)
					printf("%d %d\n", R[i].first, R[i].second);
		}
	}
}

int main()
{
	TYC::work();
	return 0;
}

Measured memory_bytes: 22520
#include <iostream>
#include <vector>
#include <string>

using namespace std;

class B {
	int N, M;
	vector<string> imgA, imgB;
public:
	void solve()
	{
		imgA.resize(N);
		imgB.resize(M);

		for (int i{ 0 }; i < N; i++)
			cin >> imgA[i];
		for (int i{ 0 }; i < M; i++)
			cin >> imgB[i];

		for (int dv{ 0 }; dv <= N - M; dv++)
		{
			for (int dh{ 0 }; dh <= N - M; dh++)
			{
				bool flag = true;
				for (int y{ 0 }; y < M; y++)
				{
					if (imgA[dv + y].substr(dh, M) != imgB[y])
					{
						flag = false;
						break;
					}
				}
				if (flag)
				{
					cout << "Yes" << endl;
					return;
				}
			}
		}

		cout << "No" << endl;
	}

	B() { cin >> N >> M; }
};


int main()
{
	B solution;
	solution.solve();

	return 0;
 }

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

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

  int N;
  cin >> N;
  cout << 180*(N-2) << endl;
}

Measured memory_bytes: 256
a, b = map(int, input().split())
if a == 1 and b == 1:
  print("Draw")
elif a == 1 and b != 1:
  print("Alice")
elif a != 1 and b == 1:
  print("Bob")
elif a > b:
  print("Alice")
elif a < b:
  print("Bob")
elif a == b:
  print("Draw")
else:
  pass

Measured memory_bytes: 2940
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(A: int, B: int):
    flag = False
    for i in range(1,3+1):
        if A * B * i % 2 == 1:
            flag = True
    if flag == True:
        print('Yes')
    else:
        print('No')
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
class abc168_a{
  public static void Main(){
    int n = int.Parse(Console.ReadLine());
    switch(n%10){
      case 3:
        Console.WriteLine("bon");
        break;
      case 0:
      case 1:
      case 6:
      case 8:
        Console.WriteLine("pon");
        break;
      default:
        Console.WriteLine("hon");
        break;
    }
  }
}


Measured memory_bytes: 17660
#include<bits/stdc++.h>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

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

	bool f = false;
	rep(i,0,k){
		if( s[i] != '1' ){
			cout << s[i] << endl;
			ret 0;
		}
	}
	
	cout << 1 << endl;
	
	ret 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<sstream>
#include<map>
#include<cmath>
using namespace std;
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1;i <=n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
typedef long long ll;
typedef long double ld;
const ll MOD =  1000000007;
struct edge {
    int to, cap, rev;// 行先　容量　逆辺
};
vector<edge> g[1010]; bool used[1010];
void add(int u, int v, int f) {
    g[u].push_back(edge{ v,f,(int)g[v].size() });
    g[v].push_back(edge{ u,0,(int)g[u].size() - 1 });
}
int dfs(int pos, int to, int f) {
    if (pos == to) return f;
    used[pos] = 1;
    rep(i, g[pos].size()) {
        if (g[pos][i].cap == 0 || used[g[pos][i].to]) continue;
        int D = dfs(g[pos][i].to, to, min(g[pos][i].cap, f));
        if (D >= 1) {
            g[pos][i].cap -= D;
            g[g[pos][i].to][g[pos][i].rev].cap += D;
            return D;
        }
    }return 0;
}
int max_flow(int s, int t) {
    int F = 0; for (;;) {
        fill(used, used + 1001, 0);
        int F2 = dfs(s, t, (1e9));
        F += F2;
        if (F2 == 0) return F;
    }return MOD;
}
int n, m, a[1000], b[1000], c[110],d[110],E;
int main() {
    cin >> n;
    req(i, n) add(0, i, 1);
    req(i, n) add(i + n, 2 * n+1, 1);
    req(i, n) cin >> a[i] >> b[i];
    req(i, n) cin >> c[i] >> d[i];
    req(i, n) {
        req(j,n) {
            if (a[i] < c[j] && b[i] < d[j]) {
                add(i, j + n, 1);
            }
        }
    }
    cout << max_flow(0, n * 2+1) << endl;
}

Measured memory_bytes: 384
import sys

sys.setrecursionlimit(6500)

N,M,K=map(int,input().split())

F=[[] for _ in range(N)]
B=[[] for _ in range(N)]
d=[-1]*N

def find(n):
    if d[n]<0:
        return n
    else:
        return find(d[n])
def union(a,b):
    a=find(a)
    b=find(b)
    if a==b:return False
    if d[a]<=d[b]:
        d[a]+=d[b]
        d[b]=a
    else:
        d[b]+=d[a]
        d[a]=b
    return True

def same(a,b):
    if find(a)==find(b):return True
    else:return False


for i in range(M):
    a,b=map(int,input().split())
    a,b=a-1,b-1
    union(a,b)
    F[a].append(b)
    F[b].append(a)

for i in range(K):
    a,b=map(int,input().split())
    B[a-1].append(b-1)
    B[b-1].append(a-1)

ans=[0]*N
for i in range(N):
    p=find(i)
    ans[i]=-d[p]-len(F[i])-1
    for b in B[i]:
        if same(i,b):
            ans[i]-=1
for i in ans:
    print(str(i),end=" ")


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

const int MAX = 3010;
const int64_t INF = 1e18+10;
int64_t dp[MAX][MAX][5];
int64_t value[MAX][MAX];

int main(){
  int R, C, K;
  cin >> R >> C >> K;
  for(int i=0; i<K; i++){
    int a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    value[a][b] = c;
  }
  
  for(int i=0; i<R; i++){
    for(int j=0; j<C; j++){
      for(int k=0; k<4; k++){
        dp[i][j][k] = INF*-1;
      }
    }
  }
  
  dp[0][0][0] = 0;
  
  if(value[0][0]){
    dp[0][0][1] = value[0][0];
  }
  
  for(int i=0; i<R; i++){
    for(int j=0; j<C; j++){
      for(int k=0; k<4; k++){
        if(dp[i][j][k] < 0){
          continue;
        }
        if(value[i+1][j]){
          dp[i+1][j][0] = max(dp[i+1][j][0], dp[i][j][k]);
          dp[i+1][j][1] = max(dp[i+1][j][1], dp[i][j][k] + value[i+1][j]);
        }
        else{
          dp[i+1][j][k] = max(dp[i+1][j][0], dp[i][j][k]);
        }
        if(value[i][j+1]){
          dp[i][j+1][k] = max(dp[i][j+1][k], dp[i][j][k]);
          dp[i][j+1][k+1] = max(dp[i][j+1][k+1], dp[i][j][k] + value[i][j+1]);
        }
        else{
          dp[i][j+1][k] = max(dp[i][j+1][k], dp[i][j][k]);
        }
      }
    }
  }
  cout << max({dp[R-1][C-1][0], dp[R-1][C-1][1], dp[R-1][C-1][2], dp[R-1][C-1][3]}) << endl;
}

Measured memory_bytes: 426996