akhauriyash/Code-Regression huggingface dataset:
/*
─────────────────────
───────────████████──
──────────███▄███████
──────────███████████
──────────███████████
──────────██████─────
──────────█████████──
█───────███████──────
██────████████████───
███──██████████──█───
███████████████──────
███████████████──────
─█████████████───────
──███████████────────
────████████─────────
─────███──██─────────
─────██────█─────────
─────█─────█─────────
─────██────██────────
─────────────────────
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
 
#define int long long
#define read(a) int a; cin >> a;
#define readarr(a, n) int a[(n) + 1] = {}; fori(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; fori(i, 1, n) {fori(j, 1, m) cin >> a[i][j];}
#define pb push_back
#define fi first
#define se second
#define rz resize
#define sz(s) (int)(s.size())
#define fori(i, a, b) for (int i = (a); i <= (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define sort1(v) sort(v.begin(), v.end()) 
#define endl '\n'
 
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair <int, int>> vpi;
typedef vector < vector <int> > vvi;
 
const int INF = 4e18;
const int mod = 1e9+7; 
     
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    //start from here

    int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    read(k);
    cout << a[k-1];

    return 0;
}


Measured memory_bytes: 256
/*
  安定なソート(ALDS1_2_C)
  2018/08/25
*/
#include<stdio.h>
#include<stdlib.h>

typedef struct{
  int num;//カードの数
  char mark;//カードのマーク
  int input_num;//カードが入ってくる順番
} Card;

void Bubblesort(Card *,int);
void Selectionsort(Card *,int);
void Judge_stable(Card *,int);
void print(Card *,int);
  
int main(void){
  
  Card *a,*b;
  int i,n;

  scanf("%d ",&n);
  a = (Card*)calloc(n,sizeof(Card));
  b = (Card*)calloc(n,sizeof(Card));
  
  for(i=0;i<n;i++){
    scanf(" %c%d",&a[i].mark,&a[i].num);
    a[i].input_num = i;
    b[i] = a[i];  
  }
  
  Bubblesort(a,n);
  Selectionsort(b,n);
  
  free(a);
  free(b);
  
  return 0;
}


void Bubblesort(Card *C, int N)
{
  int i,j;
  for(i=0;i<N;i++){
    for(j=N-1;j>i;j--){
      if(C[j].num < C[j-1].num){
	Card temp = C[j];
	C[j] = C[j-1];
	C[j-1] = temp;
      }
    }
  }

  print(C,N);
  Judge_stable(C,N);
  
}

void Selectionsort(Card *C,int N)
{
  int i,j;
  int minj;
  for(i=0;i<N;i++){
    minj = i;
    for(j=i;j<N;j++){
      if(C[j].num < C[minj].num)
	minj = j;
    }
    Card temp = C[i];
    C[i] = C[minj];
    C[minj] = temp;
  }

  print(C,N);
  Judge_stable(C,N);
}

void print(Card *c,int n)
{
  int i;
  for(i=0;i<n-1;i++)
    printf("%c%d ",c[i].mark,c[i].num);
  printf("%c%d\n",c[i].mark,c[i].num);
}


void Judge_stable(Card *c,int n)
{
  int i=0;
  int j;
  int flag = 1;
  while(i < n && flag == 1){
    j=i;
    while(j < n && flag == 1){
      if(c[i].num == c[j].num && c[j].input_num < c[i].input_num)
	flag = 0;
      j++;
    }
    i++;
  }

  if(flag == 1)
    printf("Stable\n");
  else
    printf("Not stable\n");
}


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

int main() {
  int n;
  cin >> n;
  string ret = "No";
  REP(i,1,10) REP(j,1,10) {
    if (i*j==n) { ret = "Yes"; break; }
  }
  cout << ret << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n, m;
  cin >> n >> m;
  if(n == m) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3640
<?php /*atcoder.php*/

$at = new Atcoder();
$at->main();
unset($at);

class Atcoder{
	private function arrayIn(){
		$buf = explode(" ", fgets(STDIN));
		return $this->killNewLine($buf);
	}
	private function killNewLine($buf = null){
		$buf = str_replace("\r\n", "", $buf);
		$buf = str_replace("\n", "", $buf);
		$buf = str_replace("\r", "", $buf);
		return $buf;
	}

	public function main(){
		$s = $this->arrayIn();
		
		$ans = 0;
		
		if($s[0] > $s[2]){
			echo $ans . "\n";
			return true;
		}else{
			for($i = $s[0]; $i <= $s[2]; $i += $s[0]){
				$ans += $s[1];
			}
		}
		
		echo $ans . "\n";
		return true;

	}
}
?>


Measured memory_bytes: 4728
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rp(i,a,b) for(int (i)=(int)(a);i<(int)(b);++i)
ll dp[4020][2020][2];
ll mod=924844033;
int main(){
    int N,K;
    cin>>N>>K;
    vector<ll> m;
    ll c=0,s=0;
    bool t[2001];
    for(int i=1;i<N+1;i++){
        if(!t[i]){
            s+=(N-i)/K*2;
            rp(j,0,(N-i)/K) m.push_back(c);
            c++;
            rp(j,0,(N-i)/K) m.push_back(c);
            c++;
            for(int j=i;j<=N;j+=K){
                t[j]=true;
            }
        }
    }
    dp[0][0][0]=1;
    rp(i,0,s){
        rp(j,0,min(ll(2001),ll(i+1))){
            (dp[i+1][j+1][1]+=dp[i][j][0])%=mod;
            if(m[i]!=m[i-1]) (dp[i+1][j+1][1]+=dp[i][j][1])%=mod;
            (dp[i+1][j][0]+=(dp[i][j][0]+dp[i][j][1]))%=mod;
        }
    }
    ll per[2002];
    per[0]=1;
    rp(i,1,2001){
        per[i]=(per[i-1]*i)%mod;
    }
    ll sub=0;
    for(int i=1; i<=min(ll(s),ll(N)); ++i)
    {
        if(i%2==0) sub = (sub - ((dp[s][i][0]+dp[s][i][1])*per[N-i])%mod + mod)%mod;
        else sub = (sub + ((dp[s][i][0]+dp[s][i][1])*per[N-i])%mod)%mod;
    }
    
    ll ans=(per[N]-sub+mod)%mod;
    cout << ans << endl;
    return 0;
    
};

Measured memory_bytes: 102272
def want_p(n):
 
    Q = []
 
    while n != p[n]:
        Q.append(n)
        n = p[n]
 
    for i in Q:
        p[i] = n
 
    return n
 
 
N = int(input())
 
xyi = []
yxi = []
 
for i in range(N):
 
    x,y = map(int,input().split())
    xyi.append([x,y,i])
    yxi.append([y,x,i])
 
xyi.sort()
yxi.sort()
 
line = []
 
 
for i in range(N-1):
 
    line.append([ xyi[i+1][0]-xyi[i][0] , xyi[i][2] , xyi[i+1][2] ])
    line.append([ yxi[i+1][0]-yxi[i][0] , yxi[i][2] , yxi[i+1][2] ])
 
line.sort()
 
p = [i for i in range(N)]
rank = [1] * N
num = [1] * N
ans = 0
 
for j in range(len(line)):
 
    e = line[j]
    cost = e[0]
    a = e[1]
    b = e[2]
 
    ap = want_p(a)
    bp = want_p(b)
 
    if ap != bp:
        ans += cost

        k = num[ap]
        num[ap] += num[bp]
        num[bp] += k

        if num[ap] == N or num[bp] == N:
            break
 
        if rank[ap] > rank[bp]:
            p[bp] = ap
 
        elif rank[ap] == rank[bp]:
            p[bp] = ap
            rank[ap] += 1
 
        else:
            p[ap] = bp
 
print (ans)

Measured memory_bytes: 66624
import Data.List
import Data.Ord

main = do
    [n,m] <- map read . words <$> getLine
    let ans = head . dropWhile (\d -> m `div` d < n). sortOn Down $ divisor m
    print ans

divisor n = foldr f [] $ takeWhile ((<= n) . (^ 2)) [1 .. n]
  where
    f x ds
      | r == 0
      , q /= x = x : q : ds
      | r == 0 = x : ds
      | otherwise = ds
      where
        (q, r) = n `divMod` x

Measured memory_bytes: 1020
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#define shosu(x) fixed<<setprecision(x)
using namespace std;

int n,m,inf=10000,num[25],dp[25][50005];

int func(){
	fill(dp[0],dp[0]+n+1,inf);
	dp[0][0]=0;
	for(int i=0;i<m;i++){
		for(int j=0;j<=n;j++){
			if(j<num[i]) dp[i+1][j]=dp[i][j];
			else dp[i+1][j]=min(dp[i][j],dp[i+1][j-num[i]]+1);
		}
	}
	return dp[m][n];
}

int main(){
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin>>num[i];
	}
	cout<<func()<<endl;
}

Measured memory_bytes: 5268
import sys
from pprint import pprint

def solve(n, k, q, a):
    ans = 0

    col = [0] * n
    for a_i in a:
        col[a_i - 1] += 1

    for col_i in col:
        if k - q + col_i > 0:
            print("Yes")
        else:
            print("No")

if __name__ == '__main__':
    n, k, q = map(int, sys.stdin.readline().strip().split(" "))
    a = []
    for _ in range(q):
        a.append(int(sys.stdin.readline().strip()))
    solve(n, k, q, a)

Measured memory_bytes: 50012
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 100005
ll arr[SIZE];
bool vis[SIZE];
int main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	ll N,M;
	cin>>N>>M;
	ll cnt=0;
	for(ll i=0;i<SIZE;++i){
		arr[i]=0;
		vis[i]=false;
	}
	for(ll i=0;i<M;++i){
		ll idx;
		cin>>idx;
		string str;
		cin>>str;
		if(vis[idx]==false){
			if(str[0]=='A'){
				vis[idx]=true;
				cnt++;
			}
			else{
				arr[idx]++;
			}
		}
	}
	ll p=0;
	for(ll i=1;i<=N;++i){
		if(vis[i]==true){
			p+=arr[i];
		}
	}
	cout<<cnt<<" "<<p<<endl;


}

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

int main(){
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  if(a>=k){
    cout << k << endl;
  }else if(a+b>=k){
    cout << a << endl;
  }else{
    cout << 2*a+b-k << endl;
  }
}

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

int main() {
    int n, m, x;
    cin >> n >> m >> x;
    int A[100];
    for (int i = 0; i < m; i++) {
        cin >> A[i];
    }

    int cnt_left = 0;
    int cnt_right = 0;
    for (int i = 0; i < m; i++) {
        if (A[i] < x) {
            cnt_left++;
        }
        else {
            cnt_right++;
        }
    }

    cout << min(cnt_left, cnt_right) << endl;

    return 0;
}


Measured memory_bytes: 256
//6:20
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <map>

using namespace std;
typedef long long ll;
ll max(ll a, ll b){return(a>b)?a:b;}
ll min(ll a, ll b){return(a<b)?a:b;}
ll abss(ll a){return(a<0)?-a:a;}

ll gcd(ll a, ll b){
        if(b > a){
                ll tmp = b;
                b = a;
                a = tmp;
        }
        if(b == 0) return a;
        else return gcd(b, a%b);
}
ll lcm(ll a, ll b){
        ll gcdi = gcd(a,b);
        return a/gcdi*(b);
}


char S[51];
int totalcnt[26];
int cnt[26];

int main(){
        int n;
        scanf("%d",&n);
        for(int i = 0; i < 26; i++) totalcnt[i] = 10000000;
        for(int i = 0; i < n; i++){
                scanf("%s",S);
                memset(cnt,0,sizeof(cnt));
                for(int j = 0; j < strlen(S); j++){
                        cnt[S[j]-'a']++;
                }
                for(int j = 0; j < 26; j++){
                        totalcnt[j] = min(totalcnt[j],cnt[j]);
                }
        }

        for(int i = 0; i < 26; i++){
                for(int j = 0; j < totalcnt[i]; j++) printf("%c",i+'a');
        }
        puts("");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repn(i,n) for(ll i=0;i<=(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
//cin.tie(0);
//ios::sync_with_stdio(false);

vector<bool> flag(52,false);
vector<vector<int>> e(52);



signed main(){
    int n,m,ans=0;cin>>n>>m;

    vector<P> v(m);
    
    for(int i=0;i < m;i++)
    {
        int a,b;cin>>a>>b;
        e[a].pb(b);
        e[b].pb(a);
        v[i].fi=a;v[i].se=b;
    }

    for(int i=0;i < m;i++){
        flag.assign(51,false);

        stack<int> s;
        s.push(1);

        while(!s.empty()){
            int x=s.top();
            s.pop();
            flag[x]=true;
            for(int j=0;j < siz(e[x]);j++)
            {
                if(!flag[e[x][j]] && !(x==v[i].fi && e[x][j]==v[i].se) && !(e[x][j]==v[i].fi && x==v[i].se)){
                    s.push(e[x][j]);
                }
            }
        }

        bool f=true;
        for(int i=1;i <= n;i++)
        {
            if(!flag[i])f=false;
        }
        if(!f){
            ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		
		int []d = new int [n+1];
		d[0] = 0;
		int j;
		int bound = 1;
		for( j = 1; j <= n ; j++) {
			int l = sc.nextInt();
			d[j] = d[j - 1] + l;
			if (d[j] <= x) 
				bound++;
			else {
				break;
			}
		
		}
		System.out.println(bound);

	}

}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <algorithm>
  
using namespace std;
  
int main()
{
    int a, b;
    cin >> a >> b;
    string x1;
    for (int i = 0; i < a; i++){
        x1 += to_string(b);
    }
    
    string x2;
    for (int i = 0; i < b; i++){
        x2 += to_string(a);
    }

    cout << min(x1, x2)<< endl;
} 


Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]

B = []
for i in A:
    B.append(i - 1)
    B.append(i)
    B.append(i + 1)
B.sort()

C = []
count = 0
for i in range(len(B)):
    if B[i] == B[i - 1]:
        count += 1
    else:
        C.append(count + 1)
        count = 0

print(max(C))



Measured memory_bytes: 17764
while True:
    h = int(input())
    if h==0:
        break
    puyo = [list(map(int, input().split())) for _ in range(h)]

    p = 0
    fin = 0
    turn = 1
    while fin==0:
        #[print(*puyo[i]) for i in range(h)]
        fin = 1
        for i in range(h):
            cnt = 1
            for j in range(1, 5):
                if puyo[i][j-1] == puyo[i][j] and puyo[i][j]>0:
                    cnt += 1
                else:
                    if cnt>=3:
                        p += cnt * puyo[i][j-1]
                        for k in range(cnt):
                            puyo[i][j-k-1] = -1
                            fin = 0
                    cnt = 1
                if j==4:
                    if cnt>=3:
                        p += cnt * puyo[i][j-1]
                        for k in range(cnt):
                            puyo[i][j-k] = -1
                            fin = 0
        #print('after remove')
        #[print(*puyo[i]) for i in range(h)]              
        for i in range(5):
            d_fin = 0
            while d_fin==0:
                d_fin = 1
                for j in range(h-1, 0, -1):
                    if puyo[j][i]==-1 and puyo[j-1][i]>0:
                        puyo[j][i] = puyo[j-1][i]
                        puyo[j-1][i] = -1
                        d_fin = 0
        #print(f'turn {turn}')
        turn += 1
    print(p)


Measured memory_bytes: 5628
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

int main() {
    llong ans = 0;
    llong x, y;

    cin >> x >> y;

    if (x == 3) ans += 100000;
    if (x == 2) ans += 200000;
    if (x == 1) ans += 300000;
    if (y == 3) ans += 100000;
    if (y == 2) ans += 200000;
    if (y == 1) ans += 300000;

    if (x == 1 && y == 1) ans += 400000;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}

/*------------------------------------------------------------------*/
int main(){
    int a, b, c; cin >> a >> b >> c;
    if((a < c and c < b) or (b < c and c < a)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		String s=in.next();
		String t=in.next();
		int n=s.length();
		int m=t.length();
		int[][] dp=new int[n+1][m+1];
		for (int i=1;i<=n;++i)
			for (int j=1;j<=m;++j)
				if (s.charAt(i-1)==t.charAt(j-1)) dp[i][j]=dp[i-1][j-1]+1;
				else dp[i][j]=Math.max(dp[i-1][j],dp[i][j-1]);
		String res="";
		while (n>0&&m>0) {
			if (dp[n][m]==dp[n-1][m]) --n;
			else if (dp[n][m]==dp[n][m-1]) --m;
			else {
				--n;
				--m;
				res=s.charAt(n)+res;
			}
		}
		System.out.println(res);
	}
}

Measured memory_bytes: 87188
def main():
    s = list(input())
    wox = [i for i in s if i != "x"]
    if len(wox) == 0: return 0
    wowr = list(reversed(wox))
    for i in range(len(wox)//2+1):
        if wox[i] != wowr[i]:
            return -1
    sr = list(reversed(s))
    si = ri = 0
    ret = 0
    while si < len(s) and ri < len(sr):
        if s[si] == sr[ri]:
            si += 1
            ri += 1
        elif s[si] == "x":
            si += 1
            ret += 1
        else:
            ri += 1
            ret += 1
    return (ret + len(s) - min(si,ri))//2
print(main())


Measured memory_bytes: 6312
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use proconio::{input, marker::*};
use superslice::*;
use rustc_hash::FxHashSet;
fn main() {
    input! {
        n: usize,
        ai: [i64; n],
    }
    let mut ai: Vec<_> = ai.into_iter().enumerate().map(|(i,a)| (a, i as i64)).collect();
    ai.sort_unstable();
    ai.reverse();

    let mut dp = vec![vec![0i64; n+1]; n+1];
    for i in 1..=n {
        for low in 0..=i {
            let high = i - low;
            let (score, pos) = ai[i-1];
            let low_dist = (pos - low as i64 + 1).abs();
            let high_dist = (n as i64 - high as i64 - pos).abs(); 
            if low == 0 {
                dp[low][high] = dp[low][high-1] + score * high_dist;
            } else if high == 0 {
                dp[low][high] = dp[low-1][high] + score * low_dist;
            } else {
                let low_score = dp[low-1][high] + score * low_dist;
                let high_score = dp[low][high-1] + score * high_dist;
                dp[low][high] = max(low_score, high_score);
            }
        }
    }
    let mut ans = 0;
    for i in 0..=n {
        ans = max(ans, dp[i][n-i]);
    }
    println!("{}", ans);
}


Measured memory_bytes: 33496
def subCount(arr,n,k):
    dict1={}
    cumSum = 0;
    ans =0;
    for i in range(n):
        cumSum += arr[i];
        try:
            dict1[((cumSum % k) + k) % k]+=1
            ans+=dict1[((cumSum % k) + k) % k]-1
        except:
            KeyError
            dict1[((cumSum % k) + k) % k]=1
    try:
        ans+=dict1[0]
    except:
        KeyError
    return ans;

n,m=map(int,input().split())
arr=list(map(int,input().split()))
print(subCount(arr,n,m))

Measured memory_bytes: 14696
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <vector>

typedef long long ll;
using namespace std;

int main()
{
    string s;
    int c, m = -1;

    cin >> s;

    for (int i = 0; i < s.size(); i++) {
        c = 0;
        if(s[i] == 'A' || s[i] == 'T' || s[i] == 'G' ||s[i] == 'C') {
            for(int j = i; j < s.size(); j++) {
                if(s[j] == 'A' || s[j] == 'T' || s[j] == 'G' ||s[j] == 'C') c++;
                else break;
            }
        }
        if (m < c) m = c;
    }

    cout << m << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
double pi = 3.14159265359;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

const ll mod = 1000000007;

ll modpow (ll a, ll b) {
    ll res = 1;
    while (b) {
        if (b & 1) res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = modpow (2, n) - 1;
    ll aa = 1, bb = 1;
    for (ll i = 1; i <= a; i++) {
        aa = aa * (n - i + 1) % mod * modpow (i, mod - 2) % mod;
    }
    for (ll i = 1; i <= b; i++) {
        bb = bb * (n - i + 1) % mod * modpow (i, mod - 2) % mod;
    }
    ans -= aa + bb;
    while (ans < 0) ans += mod;
    cout << ans << "\n";
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
const ll mod = 1e9+7;

ll power(ll a,ll b) {
    ll res = 1;
    while(b) {
        if(b&1) {
            res = (res*a)%mod;
        }
        a = (a*a)%mod;
        b >>= 1;
    }
    return res;
}

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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int N;
    cin >> N;
    double side = (N*1.0)/3;
    printf("%.9lf\n",side*side*side);
    return 0;
}


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

long long int dp[3001][3001][2];

long long int deque(vector<int> &v, int i, int j, bool turn) {
    if(i > j) return 0;
    if(dp[i][j][turn] != -1) return dp[i][j][turn]; // Look Up
    if(turn == 1) return (dp[i][j][turn] =  max((v[i] + deque(v, (i + 1), j, 0)), (v[j] + deque(v, i, (j - 1), 0))));
    else return (dp[i][j][turn] = min((deque(v, (i + 1), j, 1)), (deque(v, i, (j - 1), 1))));
}

int main() {
    int n;
    cin >> n;
    vector<int> v(n + 1);
    memset(dp, -1, sizeof(dp));
    long long int sum = 0;
    for(int i = 1; i <= n; i++) {
        cin >> v[i];
        sum += v[i];
    }
    long long int scoreX = deque(v, 1, n , 1);
    long long int scoreY = (sum - scoreX);
    cout << (scoreX - scoreY) << endl;
    return 0;
}

Measured memory_bytes: 144512
// template version 1.14
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;
const int MOD=1e9+7;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

signed main() {
  int n,k;cin>>n>>k;
  int r,s,p;cin>>r>>s>>p;
  string T;cin>>T;

  int ans = 0;
  vi vic(n);
  rep(i,n){
    dump(T[i]);
    if(T[i]=='r'){
      if (i-k<0 || !vic[i-k] || T[i]!=T[i-k]){
        ans += p;
        vic[i] = 1;
      }
    }
    if(T[i]=='s'){
      if (i-k<0 || !vic[i-k] || T[i]!=T[i-k]){
        ans += r;
        vic[i] = 1;
      }
    }
    if(T[i]=='p'){
      if (i-k<0 || !vic[i-k] || T[i]!=T[i-k]){
        ans += s;
        vic[i] = 1;
      }
    }
    dump(i, ans);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1232
#10000a+5000b+1000c=1000/1000*y & a+b+c=n
n,y=map(int,input().split())
y=y//1000
#10a+5b+c=y & a+b+c=n
#をみたすa,b,cの組
for i in range(y//10+1):
  for j in range((y-10*i)//5+1):
    if 10*i+5*j+1*(n-i-j)==y:
      print(i,j,n-i-j)
      exit()
      
print(-1,-1,-1)

Measured memory_bytes: 3060
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <limits>
#include <functional>
#include <cassert>
#include <numeric>
#include <bitset>

#define FOR(x,n) for(int x = 0; x < n; x++)
#define INPUT(x) scanf("%d",&x);
#define PUT(x) cout << x << endl
#define DPUT(x) printf("%.15lf\n",x)
#define GET(x,y) std::get<x>(y)
#define CHMAX(x,y) x = std::max(x,y)
#define CHMIN(x,y) x = std::min(x,y)
#define SP_END (i != n - 1 ? ' ' : '\n') ;

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;
using vch = std::vector<char>;
using vvch = std::vector<vch>;
using tiii = std::tuple<int, int, int>;

const ll mod197 = 1000000007LL;
const ll INF = 10000000000LL;

const double PI11 = 3.14159265359;

const int dis[5] = { 0,1,0,-1,0 };

const int disD[4] = { 0,1,1,0 };
const int disLD[3] = {0,1,0};

const char disC[4] = { 'U','D','R','L' };
const char disY[4] = { -1,1,0,0 };
const char disX[4] = { 0,0,1,-1 };

int main(void)
{

	int n,answer = 0;
	cin >> n;

	int arr[100] = {};

	FOR(i, n)
		cin >> arr[i];

	sort(arr,arr+n);

	FOR(i, n)
		if (i % 2)
			answer -= arr[n - i - 1];
		else
			answer += arr[n - i - 1];

	cout << answer << endl;

	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    int n;
    int a[110000];

    cin >> n;
    rep(i,n) cin >> a[i];

    int point = 0;
    int bak[110000];
    rep(i,n){
        bak[a[i]] = i+1;
    }
    rep(i,n){
        cout << bak[i+1] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int money;
  cin >> money;
  
  int A, B, X, C, D;
  
  A = money % 500;
  B = money - A;
  X = (B / 500) * 1000;
  
  C = A % 5;
  D = A - C;
  
  cout << (X + D) << endl;
}
  

Measured memory_bytes: 256
def main():
    import math
    a, b = map(int, input().split())

    for i in range(10100):
        if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
            print(i)
            break
    else:
        print(-1)


if __name__ == '__main__':
    main()


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


bool present(int* a , int n , int key) {
	for (int i = 0 ; i < n ; i++) {
		if (a[i] == key) {
			return true;
		}
	}
	return false;
}

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


	int x, n;
	cin >> x >> n;

	int a[n];
	for (int i  = 0 ; i < n ; i++) {
		cin >> a[i];
	}

	sort(a, a + n);

	if (present(a, n, x)) {
		//If the number x is present in the array
		int a1 = x ;
		int a2 = x ;
		while (present(a, n, a1)) {
			a1--;
		}
		while (present(a, n, a2)) {
			a2++;
		}
		int ans1 = abs(x - a1);
		int ans2 = abs(x - a2);
		int ans ;
		if (ans1 == ans2) {
			ans = a1;
		}
		else if (ans1 > ans2) {
			ans = a2 ;
		}
		else {
			ans = a1;
		}
		cout << ans;
	}
	else {
		cout << x;
	}


}


Measured memory_bytes: 3652
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    a,b = LI()
    if b % a == 0:
        return a + b

    return b - a



print(main())




Measured memory_bytes: 8004
import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> result = new ArrayList<Integer>();
		
		try{
			while(sc.hasNextInt()){
				int a = sc.nextInt();
				int b = sc.nextInt();
				result.add(a + b);
			}
		}catch(NoSuchElementException e){
			//üÍªIíÁ½ç½à¹¸ÉðÌubNÖ
		}
		
		for(int i = 0; i < result.size(); i++){
			System.out.println(String.valueOf(result.get(i)).length());
		}
	
	}
}

Measured memory_bytes: 0
import sys
input = sys.stdin.readline

n,m= map(int, input().split())
a= [list(map(int, input().split())) for i in range(m)]

b = [[] for i in range(n)]

for i in range(m):
    b[a[i][0]-1].append(a[i][1]-1)
    b[a[i][1]-1].append(a[i][0]-1)

import collections
from collections import deque

INF = -10 ** 9
dis = [INF for i in range(n)]
def bfs(s):
    d = deque()
    d.append(s)
    dis[s]=0
    flag = True

    while len(d):
        x = d.popleft()

        for i in range(len(b[x])):
            y=b[x][i]
            if dis[y] == INF:
                d.append(y)
                dis[y]=dis[x]+1
            else:
                if dis[y]%2!=dis[x]%2:
                    continue
                else:
                    flag=False
    return flag
q=bfs(0)
if q:
    v=0
    w=0
    for i in range(n):
        if dis[i]%2==0:
            v+=1
        else:
            w+=1
    print(v*w-m)

else:
    print(n*(n-1)//2-m)

Measured memory_bytes: 74716
#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;

int main(){
    long long n, k, a, b;
    cin >> n >> k;
    unordered_map<long long,long long> m;
    for(long long i = 0; i < n; i++){
        cin >> a >> b;
        if(m.count(a)) m[a] += b;
        else m[a] = b;
    }
    vector< pair<long long,long long> > y;
    for(auto& i : m){
        y.push_back(i);
    }
    sort(y.begin(), y.end());
    long long x = 0;
    for(auto& i : y){
        x += i.second;
        if(x >= k){
            cout << i.first << '\n';
            break;
        }
    }
}


Measured memory_bytes: 4772
#include <iostream>
using namespace std;
int main () { 
	int a, b, c ;
	cin >> a ;
	cin >> b ;
	cin >> c ;
	
	if (( a < b )&&( b < c )) {
		cout << a << " " << b << " " << c << endl ;
	} else if (( b < a )&&( a < c )) {
		cout << b << " " << a << " " << c << endl ;
	} else if (( a < c )&&( c < b )) {
 		cout << a << " " << c << " " << b << endl ;
	} else if (( b < c )&&( c < a )) {
 		cout << b << " " << c << " " << a << endl ;
	} else if (( c < a )&&( a < b )) {
 		cout << c << " " << a << " " << b << endl ;
	} else if (( c < b )&&( b < a )) {
 		cout << c << " " << b << " " << a << endl ;
	} else if (( a == b )&&( b < c )) {
	 	cout << a << " " << b << " " << c << endl ;
	} else if (( a == c )&&( c < b )) {
	 	cout << a<< " " << c << " " << b << endl ;
    } else if (( b == c )&&( c < a )) {
	 	cout << b << " " << c << " " << a << endl ;
	} else if (( a == b )&&( b == c )) {
	 	cout << a << " " << b << " " << c << endl ;
	}
}


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

using namespace std;

int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    if(n&1){
        cout<<"No"<<endl;
        return 0;
    }
    string t="";
    for(int i=0;i<n/2;i++){
        t.push_back(s[i]);
    }
    t+=t;
    if(s==t)cout<<"Yes"<<endl;
    else    cout<<"No"<<endl;
return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main {
	static FastScanner sc = new FastScanner();
	static PrintWriter out = new PrintWriter(System.out);

	public void solve() {
		int N = sc.nextInt();
		String S = sc.next();
		int max = 0;
		int sum = 0;
		
		for (char c : S.toCharArray()) {
			if (c == 'I') {
				sum++;
			} else {
				sum--;
			}
			max = Math.max(sum, max);
		}
		out.println(max);
	}

	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}
}

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: 21332
N = int(input())
slist = sorted([int(input()) for _ in range(N)])
max_num = sum(slist)
if max_num % 10 != 0:
    print(max_num)
else:
    for s in slist:
        if s % 10 != 0:
            print(max_num - s)
            break
    else:
        print(0)


Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>

using namespace std;
typedef unsigned long long ll;
ll mod = (10e+8)+ 7;

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


Measured memory_bytes: 256
void main()
{
    long n = rdElem;
    long[][] act = n.rdMat;

    long[][] dp = new long[][](n+1, 3);
    foreach (i, x; act)
    {
        foreach (j, a; x)
        {
            foreach (k; 0 .. 3)
            {
                if (k == j) continue;
                dp[i+1][j] = max(dp[i+1][j], dp[i][k]+a);
            }
        }
    }

    dp[n].reduce!max.writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 22396
#abc175b
n=int(input())
l=list(map(int,input().split()))
l.sort()
cnt=0
for i in range(n):
 for j in range(i):
  for k in range(j):
   if l[k]!=l[j] and l[i]!=l[j] and l[k]+l[j]>l[i]:
    cnt+=1
print(cnt)


Measured memory_bytes: 9092
import Data.List (group, sort)

main = putStrLn. show . solve . read =<< getLine

-- |
-- >>> solve 9
-- 0
-- >>> solve 10
-- 1
-- >>> solve 100
-- 543


solve n =
    filter' 75 +
    filter' 25 * (filter' 3 - 1) +
    filter' 15 * (filter' 5 - 1) +
    filter' 5 * (filter' 5 - 1) * (filter' 3 - 2) `div` 2
      where
        filter' m = length . filter (>= (m - 1)) $ factorizeFactorial n

primes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]

factorizeFactorial n = map length . group . sort . concatMap (factorize primes []) $ [2 .. n]

factorize ps@(p:ps') fs n
    | n == p         = p : fs
    | n `mod` p == 0 = factorize ps (p : fs) (n `div` p)
    | otherwise      = factorize ps' fs n


Measured memory_bytes: 636
#!/usr/bin/perl
use strict;
use warnings;
use feature qw(:5.10);
use utf8;

my $line = <STDIN>;
chomp $line;

my ($n, $train, $taxi) = split(/\s+/,$line);

my $T = $train * $n;

if($T >= $taxi){
    say $taxi;
}
else {
    say $T;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define LL  long long
#define LL_MAX (LL)9223372036854775807
int main()
{


	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(9);

	int N;
	cin >> N;
	int a[100];
	for(int i=0; i<N; i++) cin >> a[i];
	LL ans = LL_MAX;
	for(int i=-100; i<=100; i++){
		LL tmp = 0;
		for(int j=0; j<N; j++){
			tmp += (i-a[j])*(i-a[j]);
		}
		ans = min(ans, tmp);
	}
	cout << ans << endl;

	return 0;
}


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

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int[] n = {sc.nextInt(), sc.nextInt(), sc.nextInt()};
		Arrays.sort(n);

		System.out.println(10 * n[2] + n[1] + n[0]);
	}

}

Measured memory_bytes: 35788
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cassert>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>

using namespace std;

#define int long long
#define mp(a, b) make_pair((a), (b))
#define all(v) v.begin(),v.end()

const int INF = 1e15;

template <typename T1, typename T2>
bool cmin(T1 &a, const T2 &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T1, typename T2>
bool cmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

const int MAXN = 301;

int mat[MAXN][MAXN];

signed main()
{
    
    iostream::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    srand(1337);
    
    int n;
    cin >> n;
    
    vector<pair<int, pair<signed, signed>>> lengths;
    for (signed i = 0; i < n; i++) {
        for (signed j = 0; j < n; j++) {
            cin >> mat[i][j];
            if (j > i)
                lengths.push_back(mp(mat[i][j], mp(i, j)));
        }
    }
    
    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (cmin(mat[i][j], mat[i][k] + mat[k][j])) {
                    cout << -1;
                    exit(0);
                }
            }
        }
    }
    
    sort(all(lengths));
    int ans = 0;
    for (signed l = 0; l < lengths.size(); l++) {
        int len = lengths[l].first;
        signed u = lengths[l].second.first;
        signed v = lengths[l].second.second;
        
        bool ok = false;
        for (int i = 0; i < n; i++) {
            if (i != u && i != v && mat[u][i] + mat[i][v] == len) {
                ok = true;
                break;
            }
        }
        if (!ok)
            ans += len;
    }
    
    cout << ans;
}


Measured memory_bytes: 1784
input = gets
l,r,d = input.chomp.split("\s").map{|x| x.to_i}

# input = readlines()
# meta = input.shift.chomp.split("\s").map{|x| x.to_i}

cnt = 0

(l..r).each do |n|
  cnt += 1 if n % d == 0
end

puts cnt


Measured memory_bytes: 14380
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <iomanip>
#include <stdio.h>
#include <queue>
#include <string.h>
#include <algorithm>
#define endl '\n'
#define pb push_back
#define mp make_pair
#define LL long long
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
set<int>ss;
int main(){
	int n,x;
	cin>>n;
	while(n--){
		cin>>x;
		if(ss.count(x))return puts("NO"),0;
		ss.insert(x);
	}
	return puts("YES"),0;
}


Measured memory_bytes: 9600
# https://agc025.contest.atcoder.jp/tasks/agc025_a

N = int(input())

if N < 10:
    print(N)
    exit(0)


r = str(N)[1:]
if int(r) == 0:
    print(sum(map(int, list(str(N // 2)))) * 2)
    exit(0)


l = sum(map(int, list(str(N))))


print(l)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <unordered_map>
 
using namespace std;
using ll = long long;
// constexpr int MOD = 1e9+7;
 
void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
ll gcd(ll a, ll b){ return (b == 0) ? a : gcd(b, a % b); }
ll lcm(ll a, ll b){ return a/gcd(a, b)*b; };
 
#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define RemoveIf(a, f) a.erase(remove_if(Range(a), f), a.end())
#define Reverse(c) reverse(Range(c))
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Tie(T, ...)  T __VA_ARGS__; tie(__VA_ARGS__)

using P = pair<int, int>;

int main(void){
    Cin(int, n);
    vector<P> r(n), b(n);
    For(i, n) cin >> r[i].second >> r[i].first;
    For(i, n) cin >> b[i].first >> b[i].second;
    DeSort(r);
    Sort(b);
    int ans = 0;
    For(i, n){
        auto itr = find_if(Range(r), [b = b[i]](auto e){ return e.second < b.first && e.first < b.second; });
        if(itr != r.end()){
            ans ++;
            r.erase(itr);
        }
    }
    Cout(ans);
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef vector<int>vi;
typedef vector<ll>VI;
typedef pair<int,int>pii;
typedef pair<pii,int>Pii;
#define rep(i,a,b) for (int i=a;i<=b;++i)
#define dep(i,a,b) for (int i=a;i>=b;i--)
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define lowbit(x) ((x)&((x)^((x)-1)))
#define sz(x) int(x.size())
#pragma GCC optimize(2)
const int N=1e6+10;
const ll mod=1e9+7;
const int maxn=1e5+10;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b&1)s=s*a%mod;a=a*a%mod;b>>=1;}return s;}
ll C(ll n,ll m){ ll a=1,b=1; if (m>n-m) m=n-m; if (m<0) return 0;
 while(m){ a=a*n%mod; b=b*m%mod; m--; n--;} return a*qpow(b,mod-2)%mod;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
void init() {ios::sync_with_stdio(false); cin.tie(0);}
const double PI=3.1415926535897932;

int main(){
	init();
    ll a,b; cin>>a>>b; cout<<a*b;
	return 0;
}












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

int main() {
	string S, T;
	int ANS = 0;
	cin >> S >> T;
	for (int i = 0; i < 3; i++) {
		if (S[i] == T[i]) ANS++;
	}
	cout << ANS << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
string s[105];
int n;
int main(){
   cin>>n;
   bool flag=1;
   for(int i=1;i<=n;i++)cin>>s[i];
    for(int i=2;i<=n;i++){
    	if(s[i][0]!=s[i-1][s[i-1].size()-1]){ cout<<"No"<<endl;return 0;}
    }
    for(int i=1;i<n;i++)
        for(int j=i+1;j<=n;j++)
        {
        	if(s[i]==s[j]){ cout<<"No"<<endl;return 0;}
        }
   cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 256
A,B = map(int,input().split())

last = 2000

for i in range(12,last):
  mA = int(i*0.08)
  mB = int(i*0.10)
  
  if mA==A and mB==B:
    print(i)
    break
  if i==last-1:
    print("-1")

Measured memory_bytes: 2940