akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

class Main{

	public static void main(String[] args){

		Scanner sc =new Scanner(System.in);

		int y1=0;
		int y2=0;
		int n=sc.nextInt();
		
		for(int i=0;i<n;i++) {
		
		String x1 =sc.next();
		String x2 =sc.next();
		
		if(x1.compareTo(x2)==0) {
			y1++;
			y2++;
		}
		
		if(x1.compareTo(x2)<0) 
			y2+=3;
		
		if(x1.compareTo(x2)>0) 
			y1+=3;
		
		}
		
	    System.out.println(y1+" "+y2);

}
}


Measured memory_bytes: 30144
#include <bits/stdc++.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/irange.hpp>
#pragma clang diagnostic pop

using namespace std;

static std::string const YES = "Yes";
static std::string const NO = "No";

static bool solve(const std::vector<std::pair<int, int>>& cs) {
  std::pair<int, int> previous(-1, -1);
  for (const auto& c : cs) {
    if (c.first == previous.first && c.second != previous.second) {
      return false;
    }
    previous = c;
  }
  return true;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  std::string s;
  std::string t;
  std::cin >> s;
  std::cin >> t;
  std::vector<std::pair<int, int>> cs;
  cs.reserve(s.size());
  for (int i = 0; i < s.size(); ++i) {
    cs.emplace_back(s[i] - 'a', t[i] - 'a');
  }
  std::sort(cs.begin(), cs.end(), [](const auto& lhs, const auto& rhs) {
    return lhs.first < rhs.first;
  });
  if (!solve(cs)) {
    std::cout << NO << std::endl;
    return 0;
  }
  for (auto& c : cs) {
    std::swap(c.first, c.second);
  }
  std::sort(cs.begin(), cs.end(), [](const auto& lhs, const auto& rhs) {
    return lhs.first < rhs.first;
  });
  if (!solve(cs)) {
    std::cout << NO << std::endl;
    return 0;
  }
  std::cout << YES << std::endl;
  return 0;
}


Measured memory_bytes: 2452
n=int(input())
ar=3
sv=[0]*(10**6+2)
for i in range(2,len(sv)):
	if not sv[i]:
		sv[i]=i
		for j in range(2*i,len(sv),i):
			sv[j]=i
def di(x):
  an=1
  if sv[x]==x:
    return 2
  while x>1:
    ct=0;cr=sv[x]
    while x%cr==0:
      ct+=1;x//=cr
    an*=(ct+1)
  return an
for i in range(4,n+1):
  ar=ar+di(i-1)
if n==2:
  ar=1
print(ar)


Measured memory_bytes: 19348
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define TR ","
#define fi first
#define se second
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define repe(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define INF 100000000

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

ll waz = 76543217;

ll inv(ll x) {
    if (x == 1) { return 1; }
    if (x == 0) { return 0; }
    else {
        ll a = (waz - inv(waz % x) * (waz / x)) % waz;
        if (a >= 0) { return a; }
        else { return waz + a; }
    }
}

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<ll> p;

ll phi(ll x) {
    ll a = x;
    ll b = x;
    for (ll k = 0; k != p.size(); ++k) {
        if (a % p[k] == 0) {
            while (a % p[k] == 0) {
                a /= p[k];
            }
            b = b / p[k] * (p[k] - 1);
        }
        if (a == 1) { break; }
    }
    return b;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    IO;
    ll N, K; cin >> N >> K;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    sort(all(A));
    ll ans = 0;
    rep(i, K) ans += A[i];
    cout << ans << endl;
}

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

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

int main() {
  int n,k;
  ll s;
  cin>>n>>k>>s;
  vector<ll> vec(n);
  
  if(n==k){
    for(int i=0;i<n;i++){
      cout<<s<<" ";
    }
    return 0;
  }
  if(n==0){
    for(int i=0;i<n;i++){
      if(s==1000000000){
        cout<<999999999<<" ";
      }
      else{
        cout<<1000000000<<" ";
      }
    }
    return 0;
  }
  if(s==1){
    for(int i=0;i<k;i++){
      vec.at(i)=1;
    }
    for(int i=k;i<n;i++){
      vec.at(i)=1000000000;
    }
    for(int i=0;i<n;i++){
      cout<<vec.at(i)<<" ";
    }
    return 0;
  }
  if(s==1000000000){
    for(int i=0;i<k;i++){
      vec.at(i)=1000000000;
    }
    for(int i=k;i<n;i++){
      vec.at(i)=1;
    }
    for(int i=0;i<n;i++){
      cout<<vec.at(i)<<" ";
    }
    return 0;
  }
  
  
 // if(n%2==0){
    if(n/2>=k){
      for(int i=0;i<k;i++){
        vec.at(2*i)=s;
      }
      for(int i=0;i<n;i++){
        if(vec.at(i)!=s){
          vec.at(i)=1000000000;
        }
      }
      for(int i=0;i<n;i++){
        cout<<vec.at(i)<<" ";
      }
      return 0;
    }
    ll d=s/2;
    ll e=s-d;
    for(int i=0;i<k+1;i++){
      if(i%2==0){
        vec.at(i)=d;
      }
      else{
        vec.at(i)=e;
      }
    }
    for(int i=k+1;i<n;i++){
      vec.at(i)=1000000000;
    }
    for(int i=0;i<n;i++){
      cout<<vec.at(i)<<" ";
    }
    return 0;
 // }
}

Measured memory_bytes: 2048
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <queue>
#include <vector>

using namespace std;

inline long long read()
{
	long long x=0,f=1;char ch=getchar();
	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
	while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
	return x*f;
}

pair <long long,int> D[100050];

pair <int,int> edge[100050];

vector <int> G[100050];

int n,size[100050],tot;

long long dis[100050];

inline void dfs(int u,int fa)
{
	for (int i=0;i<G[u].size();i++)
	{
		int v=G[u][i];
		if (v!=fa)
		{
			dis[v]=dis[u]+1;
			dfs(v,u);
		}
	}
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++)
	{
		long long d=read();
		D[i]={d,i};
		size[i]=1;
	}
	sort(D+1,D+n+1);
	reverse(D+1,D+n+1);
	for (int i=1;i<n;i++)
	{
		long long delta=D[i].first-n+2*size[i];
		int l=1,r=n+1,pos=0; 
		while (l<=r)
		{
			int mid=(l+r)>>1;
			if (D[mid].first<=delta)
			{
				r=mid-1;
				pos=mid;
			}
			else
				l=mid+1;
		}
		//cout << D[pos].first << " " << delta << endl;
		if (D[pos].first!=delta)
		{
			puts("-1");
			return 0;
		}
		int u=D[i].second,v=D[pos].second;
		G[u].push_back(v);
		G[v].push_back(u);
		edge[++tot]={u,v};
		size[pos]+=size[i];
	}	
	dfs(D[n].second,0);
	long long sum=0;
	for (int i=1;i<=n;i++)
		sum+=dis[i];
	if (sum==D[n].first)
	{
		for (int i=1;i<=tot;i++)
			cout << edge[i].first << " " << edge[i].second << endl;
	}
	else
		puts("-1");
	return 0;
}


Measured memory_bytes: 12032
#include<stdio.h>

#define N 100

int main(){
  int sel[N];
  int i,j,temp,minj,cnt=0,num;

  scanf("%d",&num);

  for(i=0;i<num;i++){
    scanf("%d",&sel[i]);
  }

  for(i=0;i<num;i++){
    minj = i;
    for(j=i;j<num;j++){
      if(sel[j] < sel[minj]){	
	minj = j;
      }     
    }
    //sel[i] と sel[minj]を交換
    temp = sel[i];
    sel[i] = sel[minj];
    sel[minj] = temp;
    if (minj!=i) cnt++;
  }

  for(i=0;i<num;i++){
    if(i) printf(" ");
    printf("%d",sel[i]);
  }

  printf("\n%d\n",cnt);

  return 0;
}



Measured memory_bytes: 2732
#include <stdio.h>
int main(void){
    // Here your code !
    int A,B;
    
    scanf("%d%d",&A,&B);
    if(A > B && A != 1 && B != 1){
        printf("Alice\n");
    }
    else{
        if(A == B){
            printf("Draw\n");
        }
        else{
            if(A == 1 && A != B){
                printf("Alice\n");
            }else{
                printf("Bob\n");
            }
        }
            
        }
    return 0;
}

Measured memory_bytes: 128
from sys import stdin

def getval():
    n = int(input())
    e = [[i] + list(map(int,stdin.readline().split())) for i in range(n-1)]
    return n,e

def main(n,e):
    tree = [[] for i in range(n)]
    ans = [0 for i in range(n-1)]
    for i in e:
        tree[i[1]-1].append([i[2]-1,i[0]])
    tree[0].append(0)
    k = 1
    q = [0]
    while q:
        n = 0
        idx = q.pop(0)
        for i in range(len(tree[idx])-1):
            n += 1
            if n==tree[idx][-1]:
                n += 1
            ans[tree[idx][i][-1]] = n
            tree[tree[idx][i][0]].append(n)
            q.append(tree[idx][i][0])
        k = max(k,n)

    print(k)
    for i in ans:
        print(i)
            
            
if __name__=="__main__":
    n,e = getval()
    main(n,e)

Measured memory_bytes: 51192
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
typedef long long llong;

struct item{
    int v;
    int w;
};

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

    item I[n];
    for (int i = 0; i < n; i++){
        cin >> I[i].v >> I[i].w;
    }

    int dp[n][11000];
    dp[0][I[0].w] = I[0].v;
    for (int i = 0; i < n; i++){
        for (int j = 0; j <= w; j++){
            if (j - I[i].w < 0 || j - I[i].w > w) dp[i][j] = dp[i - 1][j];
            else dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - I[i].w] + I[i].v);
        }
    }

    cout << dp[n - 1][w] << endl;
    return 0;
}


Measured memory_bytes: 7400
#include <iostream>
 
using namespace std;
 
int main()
{
    for(int n;cin>>n,n;){
        int s=0;
        for(int i=1;i*i<=n;i++){
            if(n%i==0) s+=i,s+=n/i;
            if(i*i==n) s-=i;
            if(n/i==n) s-=n/i; 
        }
        if(n>s)  cout<<"deficient number"<<endl;
        if(n==s) cout<<"perfect number"<<endl;
        if(n<s)  cout<<"abundant number"<<endl;
    }
     
    return 0;
}


Measured memory_bytes: 2976
list :: [Int]
list = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

youbi :: [String]
youbi = ["Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"]

solve :: [[Int]] -> [String]
solve [] = []
solve ([0,0]:xs) = []
solve ([a,b]:xs) = ((!!) youbi $ flip mod 7 $ (+) b $ sum $ take (a-1) list) : solve xs

main = getContents >>= mapM_ putStrLn . solve . map (map read . words) . lines


Measured memory_bytes: 4080
n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))
hl=[]
ttl=[]
for x in h:
    tt = t-(x*0.006)
    hl.append(tt)


for y in hl:
    result = abs(a-y)
    ttl.append(result)

rel=ttl.index(min(ttl))
print(rel+1)

Measured memory_bytes: 3064
#ABC157 C - Guess The Number

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

ans = ['']*3
flag = True
for i in range(M):
    s,c = map(int,input().split(' '))
    if(ans[s-1] == '' or ans[s-1] == str(c)):
        ans[s-1] = str(c)
    else:
        flag = False

if(ans[0] == '0' and N > 1):
    flag = False
#print(flag)
#print(ans)

ansint = 0
if(flag == True):
    for i in range(3):
        if (ans[i] != ''):
            ansint += int(ans[i])*10**(N-i-1)
        elif (ans[i] == '' and i == 0 and N > 1):
            ansint += 10**(N-1)
    print(ansint)
else:
    print(-1)


Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <sstream>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
#include <list>
using namespace std;
#define INF 100000000
typedef long long int lli;
typedef pair<int,int> P;

bool f[1000000];

int main(){
	for(int i=0; i<1000000; ++i){
		f[i]=true;
	}
	f[0]=false;
	f[1]=false;
	for(int i=2; i*i<1000000; ++i){
		if(f[i]){
			for(int j=2; i*j<1000000; ++j){
				f[i*j]=false;
			}
		}
	}
	int n;
	while(cin>>n&&n){
		long long int ans=0;
		long long int count=0;
		for(int i=2; i<1000000; ++i){
			if(f[i]){
				ans+=i;
				++count;
				if(count==n) break;
			}
		}
		cout << ans << "\n";
	}
	return 0;
}

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

int main() {
    using namespace std;

    int a, b;
    cin >> a >> b;

    int w = 1;
    int e = 1;
    for (int i=2; i<=999; i++) {
        e = w + i;

        if (w - a == e - b) {
            cout << w - a << endl;
            break;
        }

        w = e;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++) 
#define all(v) begin(v),end(v)
using ll = long long;
int main() {
  int x;cin>>x;
  while(1){
    int y = x;
    bool b = true;
    for(int i = 2; i < x; i++){if (y % i == 0) b = false;}
    if (b) {
      cout << y << endl;
      return 0;
    }
    x++;
  }
}

Measured memory_bytes: 3572
G = [[] for _ in range(4)]
for _ in range(3):
    a, b = map(int,input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)

for i in range(4):
    for j in range(4):
        for k in range(4):
            for l in range(4):
                if i != j and j != k and k != l and l != i and i != k and j != l:
                    if j in G[i] and k in G[j] and l in G[k]:
                        print("YES")
                        exit()
print("NO")

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <sstream>
#include <map>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int a, L;
int nextnum(int n){
    stringstream ss;
    ss<<n;
    string s1 = ss.str();
    while(s1.size() < L) s1 += '0';
    sort(s1.begin(), s1.end());
    string s2 = s1;
    reverse(s2.begin(), s2.end());
    return atoi(s2.c_str()) - atoi(s1.c_str());
}

int main(){
    while(cin>>a>>L && (a || L)){
        map<int, int> ans;
        int res = -1;
        int res2 = 0;
        int res3;
        int cnt = 0;
        while(true){
            if(ans.count(a)){
                res = ans[a];
                res2 = a;
                res3 = cnt - res;
                break;
            }else{
                ans[a] = cnt;
            }
            a = nextnum(a);
            cnt ++;
        }
        printf("%d %d %d\n", res, res2, res3);
    }
    return 0;
}

Measured memory_bytes: 0
def create_lun(K):
    if K == 1:
        return ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
    else:
        r = []
        d = create_lun(K - 1)
        for n in d:
            c = int(n[-1])
            if K == 10 and int(n[0]) > 3:
                continue
            if c - 1 >= 0:
                r.append(n + str(c - 1))
            r.append(n + n[-1])
            if c + 1 <= 9:
                r.append(n + str(c + 1))
        r.extend(d)
        return r


def solve(K):
    A = create_lun(10)
    S = set([int(l) for l in A])
    S.remove(0)
    A = sorted(list(S))

    return A[K - 1]


if __name__ == "__main__":
    K = int(input())
    print(solve(K))


Measured memory_bytes: 122832
#include <bits/stdc++.h>
 
using namespace std;
 
#define nl  "\n"
typedef long long ll;
 
int gcd(int a, int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 

vector<ll> mnp(1e5+1 ,1e15 ) ;
map< pair<int ,int>, int > mp ; 



 int  main(){
           // ll ans = 0; 
            int r,c ; 
            cin >> r>>c ; 
            int m ; cin >> m ; 
            vector<int>  hb(r+1 ,0 ) , vb(c+1,0) ;
            int mxr= 0 , mxc = 0; 
            vector< pair<int ,int > > mkp ; 
            for( int i = 0 ; i<m ; ++i ){
                    int x , y ; cin>>x>> y ;
                    mkp.push_back( make_pair(x , y) );
                    
                    hb[x]+=1 ; vb[y ]+=1 ; 
                    mxr = max(mxr , hb[x]);
                    mxc = max( mxc , vb[y]) ;
                }
            ll ans = mxr +mxc -1 ;     
            ll mvr = 0 ,mvc =0 ;
            vector<int> visr( r+1, 0 ), visc( c+1 ,0 );   
            for( int i = 1 ;i<=r;++i ){
                    if( mxr==hb[i] ){ visr[i] = 1 ; mvr++; }
                }
             for( int i = 1 ;i<=c;++i ){
                    if( mxc==vb[i] ){visc[i] = 1 ;mvc++;}
                }
            ll count =0 ;
         //   for( auto i :visr ) cout<<i<<" "; 
          //  cout<<endl ;    
        //    for( auto i=1 ; i<=c; ++i ) cout<<visc[i]<<" ";

          //  cout<<count<<endl;
            for( auto i : mkp ){
                    if( visr[i.first]==1 and visc[i.second]==1 ){
                     //  cout<<i.first<<" "<<i.second<<endl;
                        count++;}
                }
             //   cout<<count<<endl;
               // cout<<ans<<" ";
            if( count == mvr*mvc ) cout<<ans; 
            else cout<< ans+1 ;
        }

Measured memory_bytes: 11080
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    as <- getIntList
    print . (\(x,_,_,_) -> x) $ foldl' solve (1,0,0,0) as

solve (s,a,b,c) d
    | a == d = (s',a+1,b,c)
    | b == d = (s',a,b+1,c)
    | c == d = (s',a,b,c+1)
    | otherwise = (s',a,b,c)
    where s' = s * (length (filter (== d) [a,b,c])) `mod` 1000000007

Measured memory_bytes: 14076
x, y = gets.split.map(&:to_i)

ans = 0
if x == 3
  ans += 100000
elsif x == 2
  ans += 200000
elsif x == 1
  ans += 300000
end

if y == 3
  ans += 100000
elsif y == 2
  ans += 200000
elsif y == 1
  ans += 300000
end

if x == 1 && y == 1
  ans += 400000
end
puts ans

Measured memory_bytes: 1788
#include<iostream>
#include<string>
#include<algorithm>
#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int main()
{
    int N, K;
    cin >> N >> K;
    int A[210000];
    REP(i, N) {
        cin >> A[0];
        ++ A[A[0]];
    }
    sort(A + 1, A + N + 1);
    int ans = 0;
    for (int i = 1; i < N - K + 1; ++i){
        ans += A[i];
    } 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main{
	public static void main(String[] args){
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		try {
			ArrayList<String> list = new ArrayList<String>();
			int N =Integer.parseInt(br.readLine());
			String pre = br.readLine();
			list.add(pre);
			for(int i=1;i<N;i++){
				String post = br.readLine();
				if(list.contains(post)){
					System.out.println("No");
					return;
				}
				if(pre.charAt(pre.length()-1) != post.charAt(0)){
					System.out.println("No");
                                        return;
				}
				list.add(post);
				pre = post;
			}
			System.out.println("Yes");
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			try {
				br.close();
			} catch (IOException e) {
				// NOP
			}
		}
	}

}


Measured memory_bytes: 23124
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A
import sys

nums_len = int(sys.stdin.readline())
nums_str = sys.stdin.readline().split(' ')
nums = map(int, nums_str)

print ' '.join(map(str, nums))
for i in range(1, nums_len):
    for j in reversed(range(1, i + 1)):
        if nums[j] < nums[j - 1]:
            v = nums[j]
            nums[j] = nums[j - 1]
            nums[j - 1] = v
    print ' '.join(map(str, nums))

Measured memory_bytes: 4224
import sys
 
h, w, a, b = map(int, input().split(' '))
 
if a > (w / 2) or b > (h / 2):
  print('No')
  sys.exit()

for i in range(h):
  line = ''
  for j in range(w):
    if (i<b) ^ (j<a):
      line += '1'
    else:
      line += '0'
  print(line)

Measured memory_bytes: 44764
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000100

int main(){
	
	int N;
	cin>>N;
	
	vector<vector<int>> F(N,vector<int>(10,0));
	
	for(int i=0;i<N;i++){
		for(int j=0;j<10;j++){
			cin>>F[i][j];
		}
	}
	
	int ans = -Inf;
	
	vector<vector<int>> P(N,vector<int>(11,0));
	for(int i=0;i<N;i++){
		for(int j=0;j<11;j++){
			cin>>P[i][j];
		}
	}
	
	for(int i=1;i<1024;i++){
		int sum = 0;
		for(int j=0;j<N;j++){
			int cnt = 0;
			for(int k=0;k<10;k++){
				if(F[j][k]==1&&(i>>k)%2==1){
					cnt++;
				}
			}
			sum += P[j][cnt];
		}
		ans = max(sum,ans);
	}
	
	cout<<ans<<endl;
	
    return 0;
}


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

int main(){
    int o,u,c;
    cin >> o >> u >> c;
    if(o<c&&c<u){
        cout << "Yes" << endl;
    }
    else if(o>c&&c>u){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

// const ll MOD=1000000007ll;
 const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

ll dp[4334][4334];
int blew[2525];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin>>s;
	int n=s.size();
	REP(i, n){
		blew[i+1]=blew[i]+(s[i]-'0');
	}
	dp[0][0]=1;
	REP(i, n<<1){
		int bnum=blew[min(i+1, n)];
		int rnum=min(i+1, n)*2-bnum;
		FOR(j, max(1, i+1-rnum), min(bnum, i+1)+1){
			dp[i+1][j]=(dp[i+1][j]+dp[i][j-1])%MOD;
		}
		FOR(j, max(1, i+1-bnum), min(rnum, i+1)+1){
			dp[i+1][i+1-j]=(dp[i+1][i+1-j]+dp[i][i+1-j])%MOD;
		}
	}
	cout<<dp[n<<1][blew[n]]<<'\n';
	return 0;
}


Measured memory_bytes: 135680
#include <stdio.h>
#include <stdbool.h>

int N,M,i,j;
bool graph[55][55];
bool visited[55];
int a[50],b[50];

void dfs(int v)
{
    // 隣接点を探す用
    int v2; 

    // 点vからスタート！
    visited[v] = true;

    for(v2=0;v2<N;v2++){
        // 2点をつなぐ辺が存在するか
        if( graph[v][v2] == false ){
            continue;
        }
        // 訪問済みか
        if( visited[v2] == true ){
            continue;
        }
        // 点vから点v2へ行く辺があり、v2が未訪問　⇒　v2に移動して探索続行
        dfs(v2);
    }

}

int main()
{
    scanf("%d%d",&N,&M);

    for(i=0;i<M;i++){
        scanf("%d%d",&a[i],&b[i]);
        a[i]--;
        b[i]--;
        graph[a[i]][b[i]] = true;
        graph[b[i]][a[i]] = true;
    }

    int count = 0;

    for(i=0;i<M;i++){
        // 辺を一本取り除く
        graph[a[i]][b[i]] = false;
        graph[b[i]][a[i]] = false;

        // すべての点を未訪問に
        for(j=0;j<N;j++){
            visited[j] = false;
        }

        // 深さ優先探索
        dfs(0);

        bool bridge = false;
        for(j=0;j<N;j++){
            if( visited[j] == false ){
                bridge = true;
            }
        }
        if( bridge ){
            count++;
        }

        // 取り除いたのを戻す
        graph[a[i]][b[i]] = true;
        graph[b[i]][a[i]] = true;

    }

    printf("%d\n",count);

}

Measured memory_bytes: 128
n = int( input())
# m2, d2 = map(int, input().split())

x = n / 1.08
x_decimal = x - int(x)

ret = ':('
if x_decimal == 0.0:
    ret = str(int(x))
elif x_decimal > (8 / 108):
    ret = str(int(x + 1))
print(ret)

Measured memory_bytes: 3060
//vinay
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const ll mod = 1e9+7;
#define flash ios_base::sync_with_stdio(false);cin.tie(0);
// C++ program to print all 
// permutations with duplicates allowed 
typedef pair<int, int > pii;
const int INF = 1e9+5;

int main(){
  string s;
  cin >> s;
  ll x = 0, f = 0;
  for(ll i = 0; i < s.size(); i++){
      x += s[i]-'0';
  } 
  if(x%9 == 0){
      cout << "Yes" << endl;
    }
    else
      cout << "No"<< endl;
}

Measured memory_bytes: 3700
import java.util.Scanner;

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

        String s = in.nextLine();
        int K = Integer.parseInt(s);
        for (int i=0;i<K;i++){
            System.out.print("ACL");
        }
    }
}

Measured memory_bytes: 35756
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>

static const int MOD = 1000000007;
using ll = int64_t;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    ll n, l, t;
    cin >> n >> l >> t;
    vector<pair<ll, ll>> v(n);
    vector<ll> u(n);
    ll k = 0;
    ll cnt = n*MOD;
    for (ll i = 0; i < n; ++i) {
        ll a, b;
        scanf("%li %li", &a, &b);
        v[i] = make_pair(a, b);
        u[i] = ((a+(b == 1 ? t : -t) + l*MOD)%l);
        if(i == 0) k = u[i];
        if(b == 1) cnt -= (t-l+a+l)/l;
        else cnt += (t-a-1+l)/l;
    }
    cnt %= n;
    sort(u.begin(), u.end());
    for (int i = 0; i < n; ++i) {
        printf("%li\n", u[(-cnt+n+i)%n]);
    }
    return 0;
}


Measured memory_bytes: 3584
#include<stdio.h>
#include<string.h>

int main(){
int n;
int a[101];
int i,j;
int temp;
scanf("%d",&n);
for(i=0;i<n;i++){
	
	
	
	
	scanf("%d",&a[i]);
	
	
	
	
	
}
for(i=0;i<n;i++){
	
	for(j=n-1;j>i;j--){
		
		
		if(a[j-1]<a[j]){
			
			temp=a[j];
			a[j]=a[j-1];
			a[j-1]=temp;

			
		}
		
	}
}
		
		
		
		
	
	
	
	printf("%d\n",a[0]-a[n-1]);
	
	
	
	
	
	
	
	
	
	

	return 0;
}

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

int main() {
  int N,W;
  cin >> N >> W;
  vector<int> Ans(N,0);
  for (int i=0;i<W;i++){
    int a,b;
    cin >> a >> b;
    Ans.at(a-1)++;
    Ans.at(b-1)++;
  }
  for (int i=0;i<N;i++){
    cout << Ans.at(i) << endl;
  }
}

Measured memory_bytes: 256
unittest
{
	assert( [ "2 5", "10 12 1 2 14" ].parse.expand.solve == 5 );
	assert( [ "3 7", "-10 -3 0 9 -100 2 17" ].parse.expand.solve == 19 );
	assert( [ "100 1", "-100000" ].parse.expand.solve == 0 );
}



import std.algorithm;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nm = input.front.split.to!( long[] );
	input.popFront;
	auto xs = input.front.split.to!( long[] );
	return tuple( nm[ 0 ], xs );
}

auto solve( long n, long[] xs )
{
	// 初期配置で全部の座標にコマを置けるなら移動不要
	if( xs.length <= n ) return 0;
	
	xs.sort();
	
	// 座標間の距離を計算
	auto ds = new long[ xs.length - 1 ];
	for( auto i = 0L; i < ds.length; i++ )
	{
		ds[ i ] = ( xs[ i ] - xs[ i + 1 ] ).abs;
	}
	
	// 距離が近い順の合計を計算
	ds.sort();
	return ds.take( xs.length - n ).sum;
}


Measured memory_bytes: 4460
main = do 
    n <- (read :: String -> Int) <$> getLine
    print $ test n
    where 
        test m
            | m < 10 = m
            | m < 100 = 9
            | m < 1000 = m-99+9
            | m < 10000 = 999-99+9
            | m < 100000 = m-9999+999-99+9
            | otherwise = 99999-9999+999-99+9

Measured memory_bytes: 508
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
from itertools import accumulate
from collections import Counter
#======================================================#
def main():
    n = II()
    cum = list(accumulate([0]+MII()))
    cnt = [n for n in Counter(cum).values() if n > 1]
    ans = sum([(n*(n-1))//2 for n in cnt])
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 33932
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }

int main(void){
    // Your code here!
    int n;cin >> n;
    vector<ll> a(n);rep(i,n) cin >> a[i];
    map<int,int > mp;
    rep(i,n) {
        mp[a[i]]++;
    }
    ll counter = 0;
    for (auto &x:mp){
        if (x.second-x.first >= 0) counter+=x.second-x.first;
        else counter+=x.second;
    }
    cout << counter << endl;
}


Measured memory_bytes: 5504
function main(input) {
  input = input.trim();
  const a = input.split(" ").map(Number);
  if(a[0]<=a[1]){
    console.log("0");
  }else{
    console.log(a[0]-a[1]);
  }
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 30564
#include <iostream>
#include <queue>
#include <cstring>
using namespace std;

int d[32][32];
int wx[32][32];
int wy[32][32];
typedef pair<int ,int> P;

int main(){
	int n,m,i,j,k;
	queue<P> que;

	while(cin >> n >> m, n){
		memset( d, 0, sizeof(d));
		while(que.size()) que.pop();

		for(i = 0; i <= m+1; i++) wy[i][0] = wy[i][n] = 1;
		for(i = 0; i <= n+1; i++) wx[0][i] = wx[m][i] = 1;
		for(i = 1;; i++){
			for(j = 1; j < n; j++)
				cin >> wy[i][j];
			if(i == m) break;
			for(j = 1; j < n+1; j++)
				cin >> wx[i][j];
		}

		que.push(P(1,1));
		d[1][1] = 1;

		while(que.size()){
			P p = que.front();
			que.pop();
			int px = p.first;
			int py = p.second;
			if(px == m && py == n) break;
			if(!wy[px][py] && !d[px][py+1]){
				d[px][py+1] = d[px][py] + 1;
				que.push(P(px,py+1));
			}
			if(!wx[px][py] && !d[px+1][py]){
				d[px+1][py] = d[px][py] + 1;
				que.push(P(px+1,py));
			}
			if(!wy[px][py-1] && !d[px][py-1]){
				d[px][py-1] = d[px][py] + 1;
				que.push(P(px,py-1));
			}
			if(!wx[px-1][py] && !d[px-1][py]){
				d[px-1][py] = d[px][py] + 1;
				que.push(P(px-1,py));
			}
		}
		
		cout << d[m][n] << endl;
	}
 return 0;
}

Measured memory_bytes: 924
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

ll ans = 0;
ll po2[1050];
vector <int> conn[16];
int val[16];
void aa(int n, ll c) {
	if (n == 2) {
		int cnt[2][16] = { 0, };
		ll v1 = 1, v2 = 1;
		for (auto it : conn[1]) cnt[0][val[it]]++;
		for (auto it : conn[2]) cnt[1][val[it]]++;
		
		ll lef[2] = { conn[1].size(), conn[2].size() };
		ll v[2] = { 1,1 };
		for (int i = 0;; i++) {
			ll c0 = v[0] * po2[lef[0] - cnt[0][i]] % MOD;
			ll c1 = v[1] * po2[lef[1] - cnt[1][i]] % MOD;
			ans = (ans + c * (c0*c1 % MOD)) % MOD;
			if (!cnt[0][i] || !cnt[1][i]) break;
			lef[0] -= cnt[0][i];
			lef[1] -= cnt[1][i];
			v[0] = (v[0] * (po2[cnt[0][i]] - 1)) % MOD;
			v[1] = (v[1] * (po2[cnt[1][i]] - 1)) % MOD;
		}
		return;
	}

	int cnt[16] = { 0, };
	for (auto it : conn[n]) cnt[val[it]]++;

	ll lef = conn[n].size();

	ll v = 1;
	for (int i = 0;; i++) {
		val[n] = i;
		aa(n - 1, c * (v * po2[lef - cnt[i]] % MOD) % MOD);
		if (!cnt[i]) break;
		lef -= cnt[i];
		v *= po2[cnt[i]] - 1;
		v %= MOD;
	}
}
int main() {
	int N, M, i, j;
	bool chk = false;
	scanf("%d %d", &N, &M);
	po2[0] = 1;
	for (i = 1; i <= 1000; i++) po2[i] = (po2[i - 1] * 2) % MOD;
	for (i = 1; i <= M; i++) {
		int t1, t2;
		scanf("%d %d", &t1, &t2);
		if (t1 == 1 && t2 == 2) chk = true;
		else conn[t1].push_back(t2);
	}
	aa(N, 1);
	
	ans = po2[M] - ans + MOD;
	ans %= MOD;
	return !printf("%lld\n", ans);
}

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

//container util
//------------------------------------------
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)

#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).begin(),(c).end(),greater<int>())

#define PB(a) push_back(a)

#define ALL(x) (x).begin(),(x).end()
#define MAX_EL(c) *max_element((c).begin(),(c).end())
#define MIN_EL(c) *min_element((c).begin(),(c).end())
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef string str;
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main(){
// magic spell------------------------------
  cin.tie(0);
  ios::sync_with_stdio(false);
//------------------------------------------
  int n,cnt=0;
  str s,ans;
  ans = "No";
  cin >> n >> s;
//  vi cd(n);
  EACH(i,s){
    if(*i=='R')cnt++;
  }
  if(cnt>n-cnt)ans="Yes";
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        String res = "NO";
        for (int i = 1; i <= b; i++) {
            if (a * i % b == c) {
                res = "YES";
                break;
            }
        }
        System.out.println(res);
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 2000000000
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
int coins[14]={1,6,36,216,1296,7776,46656,279936,9,81,729,6561,59049,531441};
int d[100005];
void dp(int i,int num){
	if(i==0){
		d[i]=0;
		dp(1,num);
	}else{
		int MIN=INF;
		F(j,0,14) if(i>=coins[j]) MIN=min(d[i-coins[j]]+1,MIN);
		d[i]=MIN;
		if(i!=num) dp(i+1,num);
	}
}
int main(){
	dp(0,100000);
	int n;
	while(~getI(n)) printf("%d\n",d[n]);
}


Measured memory_bytes: 768
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
import java.util.TreeMap;



public class Main {


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

		HashMap<Integer, ArrayList<Range>> leftMap = new HashMap<>();
		HashMap<Integer, ArrayList<Range>> rightMap = new HashMap<>();
		for (int i=0;i<=n;i++) {
			leftMap.put(i, new ArrayList<Range>());
			rightMap.put(i, new ArrayList<Range>());
		}

		for (int i=0;i<m;i++) {
			Range range = new Range();
			range.left=sc.nextInt();
			range.right=sc.nextInt();
			range.cost=sc.nextLong();
			leftMap.get(range.left).add(range);
			rightMap.get(range.right).add(range);
		}

		TreeMap<Long, HashSet<Range>> available = new TreeMap<>();

		Range dummy = new Range();
		dummy.left=1;
		dummy.right=1;
		dummy.cost=0L;
		dummy.totalCost=0L;
		rightMap.get(1).add(dummy);
		available.put(0L, new HashSet<Range>());
		available.get(0L).add(dummy);

		for (int i=1;i<=n;i++) {
			for (Range r : rightMap.get(i-1)) {
				if (available.containsKey(r.totalCost)) {
					available.get(r.totalCost).remove(r);
					if (available.get(r.totalCost).isEmpty()) {
						available.remove(r.totalCost);
					}
				}
			}
			for (Range r : leftMap.get(i)) {
				if (!available.isEmpty()) {
					r.totalCost=available.firstKey()+r.cost;
					if (!available.containsKey(r.totalCost)) {
						available.put(r.totalCost, new HashSet<Range>());
					}
					available.get(r.totalCost).add(r);
				}
			}
		}

		System.out.println(available.isEmpty() ? -1 : available.firstKey());
	}

}

class Range {
	int left;
	int right;
	long cost;
	long totalCost;
}




Measured memory_bytes: 124016
using System;

namespace ConsoleApp1
{

    class Program
    {
        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            for (int i = 0; i < n; i++) {
                Console.WriteLine(lcs(Console.ReadLine(), Console.ReadLine()));
            }
            
        }
        private static int lcs(string A, string B) {
            int[,] ls = new int[A.Length + 1, B.Length + 1];
            for (int i = 0; i <= A.Length; i++) ls[i, 0] = 0;
            for (int i = 0; i <= B.Length; i++) ls[0, i] = 0;
            for (int i = 1; i <= A.Length; i++)
                for (int j = 1; j <= B.Length; j++)
                    if (A[i - 1].Equals(B[j - 1]))
                        ls[i, j] = Math.Max(Math.Max(ls[i, j - 1], ls[i - 1, j]), ls[i - 1, j - 1] + 1);
                    else ls[i, j] = Math.Max(ls[i, j - 1], ls[i - 1, j]);
                
            return ls[A.Length,B.Length];
        }
    }
}




Measured memory_bytes: 34992
from collections import deque
s = deque(input())
q = int(input())
l = list(list(input().split()) for _ in range(q))
t = 0
for i in l:
  if len(i)==1:
    t += 1
  else:
    a,f,c = i
    if (f=="1" and t%2==0) or (f=="2" and t%2==1) :
      s.appendleft(c)
    else:
      s.append(c)
if t%2==1:
  s.reverse()
print(*s,sep="")
      

Measured memory_bytes: 38896
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pairSS
#define int long long
#define MOD 1000000007
int gcd(int a,int b){
  if(a==0){
    return b;
  }
  return gcd(b%a,a);
}
int lcm(int a,int b){
  return a*b/gcd(a,b);
}
int keta(int a){
  int count = 0;
  while(a!=0){
    a = a/10;
    count++;
  }
  return count;
}
signed main(){
  int a,b;
  cin >> a >> b;
  int ans = max({a+b,a-b,a*b});
  cout  << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int ans = 0;
    rep(i, n) {
        if (i+1-ans != a[i]) ans++;
    }
    if (ans != n) cout << ans << endl;
    else cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 1024
/*+lmake
 * STD = c++14
 * DEFINE += MDEBUG
 */
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
#ifdef DEBUG
     #define debug(args...)            {dbg,args; cerr<<endl;}
#else
    #define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;
#define MAXN 100000
LL f[2][MAXN+10],g[2][MAXN+10];
void solve(long long N, long long C, vector<long long> x, vector<long long> v){
	for(int i=1; i<=N; ++i) {
		LL dis=x[i-1];
		if (i>1) dis-=x[i-2];
		f[0][i]=f[0][i-1]+v[i-1]-dis;
		f[1][i]=f[1][i-1]+v[i-1]-2*dis;
	}	
	for(int i=N; i>=1; --i) {
		LL dis;
		if (i==N) {
			dis=C-x[i-1];
		} else {
			dis=x[i]-x[i-1];
		}
		g[0][i]=g[0][i+1]+v[i-1]-dis;
		g[1][i]=g[1][i+1]+v[i-1]-2*dis;
	}
	LL ans=0;
	for(int i=1; i<=N; ++i) {
		ans=max(ans,f[0][i]);
		ans=max(ans,g[0][i]);
	}
	LL Max=0;
	for(int i=1; i<N; ++i) {
		Max=max(Max,f[0][i]);
		ans=max(ans,g[1][i+1]+Max);
	}
	Max=0;
	for(int i=N; i>1; --i) {
		Max=max(Max,g[0][i]);
		ans=max(ans,f[1][i-1]+Max);
	}
	cout<<ans<<endl;
}

int main(){	
#ifdef MDEBUG
	freopen("in.txt","r",stdin);
#endif
	long long C;
	long long N;
	scanf("%lld",&N);
	vector<long long> v(N-1+1);
	vector<long long> x(N-1+1);
	scanf("%lld",&C);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&x[i]);
		scanf("%lld",&v[i]);
	}
	solve(N, C, x, v);
	return 0;
}



Measured memory_bytes: 6528
//Author : pakhandi
//
using namespace std;

#include <bits/stdc++.h>

#define wl(n) while(n--)
#define fl(i,a,b) for(i=a; i<b; i++)
#define rev(i,a,b) for(i=a; i>=b; i--)

#define si(n) scanf("%d", &n)
#define sll(l) scanf("%lld",&l)

#define debug(x) cout<<"\n#("<<x<<")#\n"
#define nline printf("\n")

#define mem(a,i) memset(a,i,sizeof(a))

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

#define PB push_back
#define SZ size
#define MP make_pair

#define IGNORE cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n');

int N, A, B;
string str1;

const string YES = "Yes\n";
const string NO = "No\n";

int taken, b;

int main()
{
	int i, j;

	cin >> N >> A >> B;
	cin >> str1;

	fl(i,0,N)
	{
		if(str1[i] == 'a')
		{
			if(taken < A + B)
			{
				cout << YES;
				taken++;
			}
			else
			{
				cout << NO;
			}
		}
		else if(str1[i] == 'b')
		{
			if(taken < A + B && b < B)
			{
				cout << YES;
				taken++;
				b++;
			}
			else
			{
				cout << NO;
			}
		}
		else
		{
			cout << NO;
		}
	}

	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 896
n = int(input())
A = list(map(int, input().split()))
B = []

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

B.sort()
medianB = B[n // 2]

Sum = 0
for i in range(n):
    Sum += abs(A[i] - (medianB + (i + 1))) 
    
print(Sum)

Measured memory_bytes: 25156
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std;
template<class T>il read(T &x){
	int f=1;char k=getchar();x=0;
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=(x<<3)+(x<<1)+k-'0';
	x*=f;
}
template<class T>il _print(T x){
	if(x/10) _print(x/10);
	putchar(x%10+'0');
}
template<class T>il print(T x){
	if(x<0) putchar('-'),x=-x;
	_print(x);
}
ll mul(ll a,ll b,ll mod){long double c=1.;return (a*b-(ll)(c*a*b/mod)*mod)%mod;}
it qpow(int x,int m,int mod){
	int res=1,bas=x;
	while(m){
		if(m&1) res=(1ll*res*bas)%mod;
		bas=(1ll*bas*bas)%mod,m>>=1;
	}
	return res;
}
const int MAXN = 20;
int n,k,x,y,ty[MAXN],ans;
vector<pair<int,int> > a[MAXN];
il chk(){
	int res=0;
	for(ri i=1;i<=n;++i){
		res+=ty[i];
		for(ri j=0;j<(int)a[i].size();++j){
			x=a[i][j].first,y=a[i][j].second;
			if(ty[i]){
				if(ty[x]==y)
					continue;
				return ;
			}
		}
	}
	ans=max(ans,res);
}
il DFS(int pos){
	if(pos==n+1)
		return chk(),void();
	ty[pos]=0,DFS(pos+1);
	ty[pos]=1,DFS(pos+1);
}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n);
	for(ri i=1;i<=n;++i){
		read(k);
		for(ri j=1;j<=k;++j)
			read(x),read(y),a[i].push_back(make_pair(x,y));
	}
	DFS(1);
	print(ans);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = 1e9+7;
int main(){
	ll n;
	cin >> n;
	ll now = 1;
	for(int i = 1;i <= n;i++){
		now *= i;
		now %= MOD;
	}

	cout << now << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    long long n; long long k; cin >> n >> k;
    long long arr[202020]; for(long long i = 0; i < n; ++i) cin >> arr[i];

    long long dis[202020], chc[202020];
    for(long long &i : dis) i = -1; for(long long &i : chc) i = -1;

    for(long long i = n - 1; i >= 0; --i)
    {
        if(chc[arr[i]] != -1) dis[i] = chc[arr[i]] - i + 1;
        chc[arr[i]] = i;
    }
    for(long long i = n - 1; i >= 0; --i)
        if(dis[i] == -1) dis[i] = n + chc[arr[i]] - i + 1;

    long long cyc[202020]; for(long long &i : cyc) i = -1;
    long long pt = 0, cnt = 0;
    while(cyc[pt] == -1)
    {
        cyc[pt] = cnt;
        cnt += dis[pt];
        pt = cnt % n;
    }

    long long ini = cyc[pt];
    long long len = cnt - cyc[pt];

    long long ori = k * n;
    if(ori >= ini) ori -= ini;
    ori %= len;

    while(ori)
    {
        if(ori >= dis[pt]) ori -= dis[pt];
        else
        {
            cout << arr[pt] << ' ';
            --ori;
        }
        pt = n - ((ori - 1) % n + 1);
    }

    return 0;
}


Measured memory_bytes: 7808