akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
/////////////////////////////////////
#define int long long  
#define lld long long double
#define mod 1000000007
#define pb push_back
#define ull unsigned long long
#define forn(i,n) for(int i=0;i<(int)n) ;i++)
#define DEBUG(a) cerr << #a << " = " << a << endl;
#define DEBUG_ARRAY(a,n)  for(long long i=0;i<(int)n;i++) cerr << a[i]<< "  ";cout<<endl;
#define max(a,b) ((a)>(b))?(a):(b)
#define min(a,b) ((a)<(b))?(a):(b)
//#define _DEBUG

using namespace std;

/////////////////////////////////////
void solve(){
  int a,b;
  cin>>a>>b;
  int ok = (a<=9 && a>=1)* ( b<=9 && b>=1) ;
  if(ok)cout<<a*b<<endl;
  else cout<<"-1"<<endl;
}
int32_t main() {
    /////////////////////////////////////
    #ifdef _DEBUG
	int tt = (int) clock();
    #endif
    /////////////////////////////////////
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /////////////////////////////////////
  
    solve();
    /////////////////////////////////////
    #ifdef _DEBUG
        cerr << "TIME = " << (double)(clock() - tt) / CLOCKS_PER_SEC << endl;
    #endif
    /////////////////////////////////////
  return 0;
}


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

int main(){
    int n, m;
    cin >> n >> m ;
    vector<pair<int,int>> v;
    for (int i=0; i<m; i++){
        int x, y;
        cin >> x >> y;
        v.push_back(make_pair(y,x));
    }
    sort(v.begin(),v.end());
    int ans=0;
    int temp=0;
    for (int i=0; i<m; i++){
        if (temp>=v[i].second){
            continue;
        }
        else {
            ans++;
            temp=v[i].first-1;
        }
        
    }
    cout << ans <<endl;
   
}

Measured memory_bytes: 1400
#include<stdio.h>
#include<string.h>
int main()
{
    int l,f=1,i;
    char s[15];
    scanf("%s",s);
    if(s[0]!='A') f*=0;
    int c=0;
    for(i=2;i<strlen(s)-1;i++){
        if(s[i]=='C') c++;
    }
    if(c!=1) f*=0;
    for(i=1;i<strlen(s);i++){
        if(s[i]!='C'&&s[i]>=65&&s[i]<=90) f*=0;
    }
    if(f==1) printf("AC\n");
    else printf("WA\n");
    return 0;
}


Measured memory_bytes: 128
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();

        sc.close();

        if (a + b >= 10) {
            System.out.println("error");
        } else {
            System.out.println(a + b);
        }
    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;
map<ll,ll> mp;

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    for(ll i=0;i<n;i++){
        cin>>a[i];
        mp[a[i]]++;
    }
    ll ans=0;
    for(auto p:mp){
        ans+=p.second*(p.second-1)/2;
    }
    for(ll i=0;i<n;i++){
        cout<<ans-mp[a[i]]+1<<endl;
    }
}

Measured memory_bytes: 12288
import java.io.*;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		try {
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			String line = new String(in.readLine());
			String[] input = line.split(" ");
			int r = Integer.parseInt(input[0].trim());
			int D = Integer.parseInt(input[1].trim());
			int x2000 = Integer.parseInt(input[2].trim());
			//System.out.println("入力値は、" + age + "と" + price);
			
			for(int i = 1;i <= 10;i++) {
				System.out.println(r * x2000 - D);
				x2000 = r * x2000 - D;
			}
		} catch (IOException e) {
			System.out.print(e);
		}
	}

}

Measured memory_bytes: 20820
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

struct Solver {
	Solver() {
		ios::sync_with_stdio( false );
		cout << fixed << setprecision( 10 );
	}

	void solve() {
		map<string, int> m;
		int q;
		cin >> q;
		while( q-- ) {
			int cmd, x;
			string key;
			cin >> cmd;

			if( cmd == 0 ) {
				cin >> key >> x;
				m[key] = x;
			}
			else {
				cin >> key;
				cout << m[key] << '\n';
			}
		}
	}
};

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



Measured memory_bytes: 25940
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int
#define fi first
#define se second
#define pub push_back
#define pi pair<int,int>
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for(int i=(int)(l);i<(int)(r);i++)
#define repd(i, l, r) for (int i=(int)(l);i>=(int)(r);i--)
#define clrg(i, l, r) for(int i=(int)(l);i<(int)(r);i++)vis[i]=0,v[i].clear();
int power(int x, unsigned int y){int res = 1;while (y > 0){ if (y & 1){res = res*x;} y = y>>1;x = x*x;}return res;}
int powermod(int x, unsigned int y, int p){int res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1; x = (x*x) % p;}return res;}
#define print2d(mat,n,m){for(int i=0;i<(int)(n);i++){for(int j=0;j<(m);j++){cout<<mat[i][j]<<" ";}cout<< endl;}}
#define clr(a,x) memset(a,x,sizeof(a))
#define rr(v) for(auto &val:v)
#define print(v) for (const auto itr : v){cout<<itr<<' ';}cout<<"\n";
#define ln length()
#define sz size()
#define mod 1000000007
#define elif else if
int32_t main(){
   int n; cin>>n;
   vector<pi> vp;
   rep(i,0,n){
     int a,b; cin>>a>>b;
     vp.pub({a,b});
   }
   sort(all(vp));
   vector<int> v,u;
   rep(i,0,n){
    v.pub(vp[i].fi+vp[i].se),u.pub(vp[i].fi-vp[i].se);
   }
   sort(all(v)); sort(all(u));
   cout<<max(v.back()-v[0],u.back()-u[0])<<"\n";
   return 0;
}
/*
Edge cases? n=1? a[i]<=0?
long vs int? 1LL? 64bits?
Re-read problem. Is it as easy as it seems?
KEEP CORRECTING AND SUBMITTING!
*/


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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);

const int N = 300005;
const LL MOD = 1e9 + 7;
LL n , ara[N];
int main()
{
    cin >> n;
    for(int i = 1;i <= n;i++){
        cin >> ara[i];
    }
    LL ans = 0;
    for(LL b = 0;b < 60;b++){
        LL zr = 0, one = 0;
        for(int i = 1;i <= n;i++){
            if(ara[i] & (1LL << b))one++;
            else zr++;
        }
        LL cnt = zr * one;
        cnt %= MOD;
        LL val = (1LL << b) % MOD;
        ans = (ans + val * cnt) % MOD;
    }
    cout << ans << "\n";
}




Measured memory_bytes: 2560
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

import System.Exit

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ a, b, c, k ] :: [Integer] <- map read . words <$> getLine
	let
		diff = if k `mod` 2 == 0 then a - b else -a + b
	putStrLn $ if abs diff <= 10 ^ 18 then show diff else "Unfair"

Measured memory_bytes: 508
s = input()
S = input()
flag = False
ans = []
for i in range(len(s)-len(S)+1):
    if s[i] == S[0] or s[i] == "?":
        a = s[i:i+len(S)]
        for j in range(len(S)):
            if a[j] == S[j] or a[j] == "?":
                continue
            break
        else:
            flag = True
            ans.append(s[:i]+S+s[i+len(S):])
if not flag:
    print("UNRESTORABLE")
    exit()
for i in range(len(ans)):
    ans[i] = ans[i].replace("?","a")
ans.sort()
print(ans[0])

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

public class Main{
    
    public static void main(String[] args) throws IOException {
        int N = in.nextInt();
        int T[] = new int[N];
        int sum = 0;
        for(int i = 0; i < N; i++){
        	T[i] = in.nextInt();
        	sum += T[i];
        }
        int M = in.nextInt();
        int P[] = new int[M];
        int X[] = new int[M];
        for(int i = 0; i < M; i++){
        	P[i] = in.nextInt();
        	X[i] = in.nextInt();
        }

        for(int i = 0; i < M; i++){
        	println(sum - T[P[i]-1] + X[i]);
        }
        
        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);
    static void read(int arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.nextInt(); } }
    static void read(long arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.nextLong(); } }
    static void read(String arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.next(); } }
    static void print(Object O){ out.print(O); }
    static void println(Object O){ out.println(O); }
    static void print(int arr[]){ for(int i = 0; i < arr.length; i++){ print(arr[i]+" "); } println(""); }
    static void print(int arr[][]){ for(int i = 0; i < arr.length; i++){ print(arr[i]); } }
    static void debug(Object O){ System.out.println(O); }
}

class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { 
        return Integer.parseInt(next()); 
    }
    
    double nextDouble() throws IOException { 
        return Double.parseDouble(next());
    }
    
    long nextLong() throws IOException { 
        return Long.parseLong(next()); 
    }
    
    String nextLine() throws IOException { 
        return reader.readLine(); 
    }
    
    void close() throws IOException { 
        reader.close(); 
    }
}

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

const string ButtonTable = "22233344455566677778889999";

string hash(const string& s)
{
  string t = "";
  for (unsigned int i = 0; i < s.size(); ++i)
    t += ButtonTable[s[i] - 'a'];
  return t;
}

void solve(multimap<string, string>& dic, string seq, string ans)
{
  for (unsigned int i = 1; i <= seq.size(); ++i) {
    string h = seq.substr(0, i), rem = seq.substr(i);
    for (multimap<string, string>::iterator it = dic.find(h); it != dic.end() && (*it).first == h; ++it) {
      if (rem.empty()) 
	cout << ans << (*it).second << "." << endl;
      else
	solve(dic, rem, ans + (*it).second + " ");
    }
  }
  return;
}

int main()
{
  int n;
  while (cin >> n) {
    if (n == 0)
      break;

    multimap<string, string> dic;
    for (int i = 0; i < n; ++i) {
      string s;
      cin >> s;
      dic.insert(multimap<string, string>::value_type(hash(s), s));
    }

    string seq;
    cin >> seq;
    solve(dic, seq, "");

    cout << "--" << endl;

  }
  return 0;
}

Measured memory_bytes: 0
from bisect import bisect_left
N = int(input())
A = [int(x)*2 for x in input().split()]
L = [0] * (N+1)
for i in range(N):
    L[i+1] = L[i] + A[i]
mid = L[N] // 2
midL = bisect_left(L, mid)
l, r = L[midL-1:midL+1]
print(min(mid-l, r-mid))


Measured memory_bytes: 27560
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  int a,b;
  cin >> a >> b;
  if (a < b) {
    cout << 0;
  } else {
    cout << 10;
  }
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
  cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
    //配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


Measured memory_bytes: 256
n = int(input())
H = list(map(int,input().split()))

for i in range(1,n-1):
    if H[n-1-i] == H[n-i] + 1:
        H[n-1-i] -= 1
    elif not(H[n-1-i] == H[n-i] or H[n-1-i] < H[n-i]):
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 20760
package main

import (
    . "fmt"
    "strings"
)

func main() {
    var s string
    Scanf("%s", &s)

    ans := 700
    sa := strings.Split(s, "")
    for _, v := range sa {
        if v == "o" {
            ans += 100
        }
    }

    Println(ans)
 }


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

int main()
{
	auto& in = cin;

	long long N;
	in >> N;
	long long D;
	in >> D;
	long long D2 = D * D;
	long long num = 0;
	for (long long i = 0; i < N; ++i) {
		long long x, y;
		in >> x >> y;
		long long d2 = x * x + y * y;
		if (d2 <= D2)
			++num;
	}
	cout << num;

	return 0;
}


Measured memory_bytes: 3648
#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main() {

    ll x, a, b;
    cin >> x >> a >> b;

    if(abs(x-a) > abs(x-b)){
        cout << "B" << endl;
    }else{
        cout << "A" << endl;
    }

}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}

import qualified Data.ByteString.Char8 as B
import Control.Monad
import Data.Array
import qualified Data.Vector.Unboxed as UV

import Data.Array.ST
import Control.Monad.ST

main=do
    n<-readLn::IO Int
    as<-UV.unfoldr(B.readInt.B.dropWhile(<'!'))<$>B.getLine::IO (UV.Vector Int)
    print $ g (fromIntegral n) $ acc as

acc :: UV.Vector Int -> (Int,Int,Int)
acc as = (a1,a2,a3) where
    av = UV.accumulate (+) (UV.replicate 3 0) $ UV.concatMap ma as
    ma 1 = UV.singleton (0,1)
    ma 2 = UV.fromList [(0,1),(1,1)]
    ma 3 = UV.fromList [(0,1),(1,1),(2,1)]
    a1 = av UV.! 0
    a2 = av UV.! 1
    a3 = av UV.! 2

g::Double->(Int,Int,Int)->Double
g n (!a1,!a2,!a3) = runST $ do
    e <- newArray ((0,0,0),(a1,a2,a3)) (-1.0) :: ST s (STUArray s (Int,Int,Int) Double)
    writeArray e (0,0,0) 0.0
    rd e (a1,a2,a3)
    where
        rd :: STUArray s (Int,Int,Int) Double -> (Int,Int,Int) -> ST s Double
        rd e (i,j,k) = do
            e0 <- readArray e (i,j,k)
            if e0 >= 0
                then return e0
                else do
                    e1 <- if i>j then (* (fromIntegral (i-j)/n)) <$> rd e (i-1,j,k) else pure 0.0
                    e2 <- if j>k then (* (fromIntegral (j-k)/n)) <$> rd e (i,j-1,k) else pure 0.0
                    e3 <- if k>0 then (* (fromIntegral k/n))     <$> rd e (i,j,k-1) else pure 0.0
                    let en = (e1+e2+e3+1) * n / fromIntegral i
                    writeArray e (i,j,k) en
                    return en

Measured memory_bytes: 217340
t1,t2 = map(int,input().split())
a1,a2 = map(int,input().split())
b1,b2 = map(int,input().split())
if a1*t1+a2*t2==b1*t1+b2*t2:
    print("infinity")
    quit()
x = (a1-b1)*t1
y = (a2-b2)*t2
if x < 0:
    x,y = -x,-y
d = x+y
if d > 0:
    print(0)
    quit()
if x%(-d) == 0:
    print(2*(x//(-d)))
else:
    print(2*(x//(-d))+1)



Measured memory_bytes: 9204
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
using namespace std;

const int N = 1e6+69, mod = 998244353;

ll n,m,mx,ind,ans,len,x,y,a,b,t,k,T;

ll fix[N],A[N],dp[N],B[N];

vector< ll > v[N];

vector< pair<ll,ll> > P;
string s[N],S;


int main(){

    ios::sync_with_stdio(0);

    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>s[i]>>A[i];
    }


    cin>>S;
    bool ok = false;
    for(int i=1;i<=n;i++){
        if(ok)
        ans += A[i];
        if(S==s[i]){
            ok = true;
        }
    }

    cout<<ans<<endl;

}


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

const ll INF = 100100100100;

int main() {
  int N, K;
  cin >> N;
  vector<ll> A(N), B(N), C(N);
  int a, b, c;
  rep(i, N) cin >> A[i] >> B[i] >> C[i];
  for (int i = 1; i < N; i++) {
    A[i] += max(B[i - 1], C[i - 1]);
    B[i] += max(C[i - 1], A[i - 1]);
    C[i] += max(A[i - 1], B[i - 1]);
  }
  cout << max(A.back(), max(B.back(), C.back())) << endl;
}

Measured memory_bytes: 2560
def parser(i):
    idx = i
    dep = s[i].count('.')
    i += 1
    arr = []
    while i < N and s[i].count(".") > dep:
        if "+" in s[i] or "*" in s[i]:
            num, i = parser(i)
            arr.append(num)
        else:
            arr.append(int(s[i].replace('.', '')))
        i += 1
    if "+" in s[idx]:
        return sum(arr), i - 1
    else:
        ret = 1
        for num in arr:
            ret *= num
        return ret, i - 1

while True:
    N = int(input())
    if not N:
        break
    if N == 1:
        print(input())
        continue
    s = [input() for _ in range(N)]
    print(parser(0)[0])

Measured memory_bytes: 7656
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}

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

  ll x;
  cin >> x;

  ll ans = x/11;
  x -= (ans*11);
  ans*=2;
  if(x>6) ans+=2;
  else if(x>0) ans+=1;

  cout << ans << endl;

  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#4 Div Game
def prime_factorize(n):
    a = []
    tmp = n
    for i in range(2,int(n**0.5//1+1)):
        if tmp%i == 0:
            cnt = 0
            while tmp%i == 0:
                cnt += 1
                tmp //= i
            a.append([i,cnt])
        
    if tmp != 1:
        a.append([tmp,1])
    
    if a == []:
        a.append([n,1])
    
    return a

n = int(input())

x = prime_factorize(n)
cnt = 0


for i in range(len(x)):
    if x[0][0]==1:
        break
        
    k = x[i][1]
    for j in range(k):
        if n%(x[i][0]**(j+1)) == 0:
            n //= x[i][0]**(j+1)
            cnt += 1
            k-=(j+1)
        elif n%(x[i][0]**(j+1)) != 0:
            break
        if k <= 0:
            break
print(cnt)        

Measured memory_bytes: 9496
#include <stdio.h>
#include <math.h>

int main(void)
{
    int i,n;
    double x1,y1,x2,y2,x3,y3,px,py,r;
    double a1,b1,c1,a2,b2,c2;
    scanf("%d",&n);

    for(i=0; i<n; i++) {
        scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
        a1 = 2.00*(x2-x1);
        b1 = 2.00*(y2-y1);
        c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;
        a2 = 2.00*(x3-x1);
        b2 = 2.00*(y3-y1);
        c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;
        px = (b1*c2-b2*c1) / (a1*b2 - a2*b1);
        py = (c1*a2-c2*a1) / (a1*b2 - a2*b1);

        r = sqrt(pow(fabs(x1-px),2) + pow(fabs(y1-py),2));
        
        printf("%.3lf %.3lf %.3lf\n",px,py,r);
    }

    return 0;
}

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

int T, P, R;

struct team{
    int tID;
    int correct_n;
    int wrong[11];
    int penalty;
};

struct team teams[51];

void sort_c(struct team teams[], int n)
{
    int i, j;

    for(i = 0; i < n - 1; i++){
        for(j = 1; j < n; j++){
            if(!(teams[j].correct_n < teams[j - 1].correct_n)){
                struct team t = teams[j];
                teams[j] = teams[j - 1];
                teams[j - 1] = t;
            }
        }
    }
}

void sort_p(struct team teams[], int n)
{
    int i, j;

    for(i = 0; i < n - 1; i++){
        for(j = 1; j < n; j++){
            if(!(teams[j].penalty > teams[j - 1].penalty)){
                struct team t = teams[j];
                teams[j] = teams[j - 1];
                teams[j - 1] = t;
            }
        }
    }
}

void sort_t(struct team teams[], int n)
{
    int i, j;

    for(i = 0; i < n - 1; i++){
        for(j = 1; j < n; j++){
            if(!(teams[j].tID > teams[j - 1].tID)){
                struct team t = teams[j];
                teams[j] = teams[j - 1];
                teams[j - 1] = t;
            }
        }
    }
}

int main(void)
{
    while(1){
        int i, j;
        scanf("%d %d %d", &T, &P, &R);

        if(T == 0 && P == 0 && R == 0)
            break;

        for(i = 1; i <= T; i++){
            teams[i].tID = i;
            teams[i].correct_n = 0;
            for(j = 0; j <= 10; j++){
                teams[i].wrong[j] = 0;
            }
            teams[i].penalty = 0;
        }

        for(i = 1; i <= R; i++){
            int tID, pID, time;
            char message[8];

            scanf("%d %d %d %s", &tID, &pID, &time, message);

            if(strcmp(message, "CORRECT") == 0){
                teams[tID].correct_n++;
                teams[tID].penalty += (teams[tID].wrong[pID] * 1200 + time);
            }else if(strcmp(message, "WRONG") == 0){
                teams[tID].wrong[pID]++;
            }
        }

        sort_c(teams + 1, T);

        teams[T + 1].correct_n = -1;
        i = 1;
        while(1){
            j = i;
            while(teams[i].correct_n == teams[j].correct_n){
                j++;
            }
            sort_p(teams + i, j - i);
            if(j > T + 1)
                break;
            i = j;
        }

        teams[T + 1].penalty = -1;
        i = 1;
        while(1){
            j = i;
            while(teams[i].penalty == teams[j].penalty){
                j++;
            }
            sort_t(teams + i, j - i);
            if(j > T + 1)
                break;
            i = j;
        }

        for(i = 1; i <= T; i++){
            printf("%d %d %d\n", teams[i].tID, teams[i].correct_n, teams[i].penalty);
        }
    }

    return 0;

}

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

#define int long long
using namespace std;
const int N=1e5+10;
struct T
{
    int pos,val;
} a[N];

bool cmp(T a,T b)
{
    if(a.val==b.val)return a.pos<b.pos;
    return a.val>b.val;
}
int n,ans[N];

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
            cin>>a[i].val;
            a[i].pos=i;
    }
    sort(a+1,a+n+1,cmp);
    a[n+1].val=0;
    int tmp=1;
    int num=a[1].pos;
    for(int i=2;i<=n+1;i++)
    {
        if(a[i].val==a[i-1].val) tmp++;
        else
        {
            ans[num]+=(a[i-1].val-a[i].val)*tmp;
            tmp++;
        }
        if(a[i].pos<num) num=a[i].pos;
    }
    for(int i=1;i<=n;i++) cout<<ans[i]<<'\n';
}


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

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

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; }}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; }}

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

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

unordered_set<ll> divisor(ll n) {
    unordered_set<ll> res;

    for (ll i = 1; i*i <= n; ++i) {
        if (n % i == 0) {
            res.insert(i);
            res.insert(n/i);
        }
    }

    return res;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int ans = 0;
    ll N; cin >> N;
    unordered_set<ll> set;
    for(ll x: divisor(N)) {
        if (x==1) continue;
        ll n = N;

        while(n % x == 0) n /= x;
        n %= x;
        if (n == 1) ++ans;
    }
    ans += divisor(N-1).size() - 1;
    cout << ans << endl;

}


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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll int64_t
#define all(v) v.begin(), v.end()
#define bitrep(n) for(int bit=0;bit<(1<<n);bit++)
#define bitrep2(n) for(int bit2=0;bit2<(1<<n);bit2++)


int main() {

int H,W,K; cin >> H >> W >> K;

vector<vector<int>> S(H,vector<int>(W)) ;

rep(i,H){
  rep(j,W){
    char a;
    cin >> a;
    if(a=='.') S[i][j]=0;
    else S[i][j]=1;
  }
}

int ans=0;

bitrep(H){
  bitrep2(W){
  int temp=0;
  vector<vector<int>> c(H,vector<int>(W)) ;
  rep(i,H){
    rep(j,W){
      c[i][j]=S[i][j];
    }
  }



  rep(i,H){//行
    if (bit & (1<<i)) { // 列挙に i が含まれるか
      rep(j,W) c[i][j]=2;
    }
  }

  rep(i,W){//列
    if (bit2 & (1<<i)) { // 列挙に i が含まれるか
      rep(j,H) c[j][i]=2;   
    }
  }

  rep(i,H){
    rep(j,W){
      if(c[i][j]==1) temp++;
    }
  }
  
  /*rep(i,H){//元に戻す
    if (bit & (1<<i)) { // 列挙に i が含まれるか
      rep(j,W){
        if(c[i][j]==1) c[i][j]=0;
        else c[i][j]=1;        
      }
    }
  }*/

  if(temp==K) ans++;
  }
  

}       



cout << ans << endl;

return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define pb push_back
const ll mod=1e9+7;
template<typename T> T pow(T a,T b, long long m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }
const ll N=1e5+8;
const ll INF=1e18;
ll dp[103][N],vis[103][N];
ll n,W;
ll func(ll w[],ll v[],ll W,ll n){
if(W<=0)
return 0;
if(n==0)
return INF;
if(vis[n][W])
return dp[n][W];
vis[n][W]=1;
return dp[n][W]=min(w[n]+func(w,v,W-v[n],n-1),func(w,v,W,n-1));

}
int main(){
	cin>>n>>W;
	ll v[n+1],w[n+1],sum=0;
	for(ll i=1;i<=n;i++)
	cin>>w[i]>>v[i];
	for(ll i=1;i<=n;i++)
       sum+=v[i];
	   //cout<<sum<<endl;
	for(ll i=1;i<=n;i++){
		for(ll j=0;j<=sum;j++)
		dp[i][j]=INF;
	}
	memset(vis,0,sizeof(vis));
	for(ll i=sum;i>=0;i--){
		if(func(w,v,i,n)<=W){
			cout<<i;
			return 0;
		}
	}
	cout<<0<<endl;
}

Measured memory_bytes: 160000
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<string.h>
#include<math.h>
#define maxn 1<<17
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;

int main()
{
    long long n,m;
    while(cin>>n>>m){
        cout<<(n-1)*(m-1)<<endl;
    }
    return 0;
}


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

typedef long long ll;
const int INF = 1 << 30;


// 3,5,7のみからなる数値を生成し、その数が753数かをチェックするbool関数を作成して考えればできそう...?

ll n;

bool check(ll x){
    string s = to_string(x);

    return (s.find('3') != string::npos && 
            s.find('5') != string::npos && 
            s.find('7') != string::npos);
}

int dfs(ll x){
    if (x > n){
        return 0;
    }

    ll res;
    if (check(x)){
        res = 1;
    } else {
        res = 0;
    }

    res += dfs(x*10 + 3);
    res += dfs(x*10 + 5);
    res += dfs(x*10 + 7);

    return res;
}

int main(){
    cin >> n;

    cout << dfs(0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using bint = boost::multiprecision::cpp_int;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int H, W;
    cin >> H >> W;
    vector<string> s(H);
    rep(i,H) cin >> s[i];
    int dp[100][100];
    dp[0][0] = ((s[0][0] == '.')? 0 : 1);
    repSE(j,1,W) {
        if (s[0][j] == '#' && s[0][j-1] == '.')
            dp[0][j] = dp[0][j-1] + 1;
        else
            dp[0][j] = dp[0][j-1];
    }
    repSE(i,1,H) {
        if (s[i][0] == '#' && s[i-1][0] == '.')
            dp[i][0] = dp[i-1][0] + 1;
        else
            dp[i][0] = dp[i-1][0];
    }
    repSE(i,1,H) repSE(j,1,W) {
        int dpi_1 = dp[i-1][j], dpj_1 = dp[i][j-1];
        if (s[i][j] == '#' && s[i-1][j] == '.') dpi_1 += 1;
        if (s[i][j] == '#' && s[i][j-1] == '.') dpj_1 += 1;
        dp[i][j] = min(dpi_1, dpj_1);
    }
    cout << dp[H-1][W-1] << endl;
    return 0;
}


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define SORT_ASC(c) sort((c).begin(), (c).end())
#define SORT_DESC(c) sort((c).begin(), (c).end(), greater<typeof((c).begin())>())

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

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;

void Main()
{
    int a,b;
    cin >> a >> b;
    if((a+b)%2 == 0){
        cout << (a+b)/2 << endl;
    }
    else{
        cout << "IMPOSSIBLE" << endl;
    }
    
    return;
}
int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int i,len,cnt=0;
    char input[1000];
    while(1){
        if(scanf("%s",input)==EOF)break;
        len=strlen(input);
        int sw=1;
        for(i=0;i<len/2;i++){
            if(input[i]!=input[len-1-i]){
                sw=0;
                break;
            }
        }
        cnt+=sw;
    }
    printf("%d\n",cnt);
    return 0;
}

Measured memory_bytes: 540
n, k, s = map(int, input().split())

a = [0 for i in range(n)]

if s == 1:
    b = 1
else:
    b = -1

for i in range(n):
    if i < k:
        a[i] = s
    else:
        a[i] = s + b

print(" ".join(map(str,a)))

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

const int MAXN = 1e5 + 10;
const long long INF = 1e13;

long long dp[MAXN];

int main(){	
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	dp[0] = 0;
	int N,W;
	cin >> N >> W;
	for(int i = 1; i < MAXN; i++){
			dp[i] = INF;
	}
	for(int i = 1; i <= N; i++){
			int w,v;
			cin >> w >> v;
			for(int j = MAXN - 1; j >= 1; j--){
					if(j < v) break;
					if(dp[j-v] + (long long)w <= W) dp[j] = min(dp[j], dp[j-v] + (long long)w);
			}
	}
	for(int j = MAXN - 1; j >= 0; j--){
			if(dp[j] < INF){
					cout << j << endl;
					break;
			}
	}
	return 0;
}


Measured memory_bytes: 4400
import java.io.{BufferedReader, InputStream, InputStreamReader}
import java.util.StringTokenizer

import scala.collection.mutable
import scala.util.Sorting
import math.{abs, max, min}

object Main {
  def solve(): Unit = {
    val sc = new InputReader(System.in)
    val N = sc.nextInt()
    val A = Array.fill[Int](N)(sc.nextInt())
    val k = N - A.distinct.length
    val ans = if ((k & 1) == 0) N - k
    else N - k - 1
    println(ans)
  }

  def main(args: Array[String]): Unit = {
    solve()
  }



  private class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = null

    def next: String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next.toInt
    def nextLong(): Long = next.toLong
    def nextChar(): Char = next.charAt(0)
  }

}


Measured memory_bytes: 41272
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <functional>
#include <array>

using namespace std;

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;

    vector<int> l(N), r(N);
    for(int i = 0; i < N; ++i){
        if(i != 0) l[i] = l[i-1];
        if(S[i] == 'W'){
            l[i]++;
        }
    }
    for(int i = N-1; i >= 0; --i){
        if(i != N-1) r[i] = r[i+1];
        if(S[i] == 'E'){
            r[i]++;
        }
    }

    int ans = 1000000;
    for(int i = 0; i < N; ++i){
        int sum = 0;
        if(i != 0) sum += l[i-1];
        if(i != N-1) sum += r[i+1];
        ans = min(ans, sum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3076
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ps push_back
#define mod 1000000007
#define fi first
#define so second
#define pii pair<int,int>
#define TT int tt;cin>>tt;while(tt--)

signed main()
{
    string s;
    cin>>s;
    int f=0;
    for(int i=0;i<3;i++) if(s[i]=='7') {f=1;break;}
    if(f==1) cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 3628
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <string>
#include <math.h>
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

typedef long long ll; //64bit型
using namespace std;
const ll INF = 1LL << 20;

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

int main()
{
        int N;
        cin >> N;
        vector<ll> vec(N);
        for (int i = 0; i < N; i++)
        {
                cin >> vec[i];
        }

        vector<ll> sum(N + 1);
        sum[0] = 0;
        for (int i = 1; i < N + 1; i++)
        {
                sum[i] = sum[i - 1] + vec[i - 1];
        }
        map<ll, int> mp;

        ll cnt = 0;
        for (int i = 0; i < N + 1; i++)
        {
                mp[sum[i]]++;
        }

        map<ll, int>::iterator itr;

        for (itr = mp.begin(); itr != mp.end(); itr++)
        {
                ll a = itr->second;
                cnt += ((a - 1) * a) / 2;
        }
        cout << cnt << endl;
        return 0;
}


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

#define rep(i,n) for(int i = 0;i < n;++i)
#define rep2(i,n,m) for(int i = n;i < m;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;

const int INF = 1001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int h,n;
    cin >> h >> n;
    vector<int> dp(h+1,INF);
    dp[0] = 0;
    rep(i,n){
        int a,b;
        cin >> a >> b;
        rep(j,h){
            int nj = min(j+a,h);
            dp[nj] = min(dp[nj],dp[j]+b);
        }
    }
    cout << dp[h] << endl;


    cout << endl;
    return 0;
}

Measured memory_bytes: 256
a,b,c,d=[int(x) for x in input().split()]
ans=max(a*c,b*d)
if a<0 and b<0:
  cc=a
  a=b
  b=cc

if c<0 and d<0:
  cc=c
  c=d
  d=cc

print(max(a*c,b*d,ans))

Measured memory_bytes: 61768
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T iabs(const T& x) { return max(x, -x); }
// #define abs gabs

int main() {
    int n;
    cin >> n;
    int ans = 1000;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        int y = 0;
        for (; x % 2 == 0; x /= 2) ++y;
        ans =min (ans, y);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#define pi 3.14159265358979323846264338327950



int main() {
	long long N; std::cin >> N;
	std::vector<long long> A(N);
	long long count = 0;
	long long min = 10000000000;
	for (auto& r : A) {
		count = 0;
		std::cin >> r;
		while(true){
			if (r % 2 == 1)
				break;
			++count;
			r /= 2;
		}
		if (count < min)min = count;
	}
	std::cout << min << std::endl;

	return 0;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <vector>

double solve(int n, const std::vector<int>& array)
{
  return 1.0 / std::accumulate(
      array.begin(),
      array.end(),
      0.0,
      [](double sum, int a) { return sum + 1.0 / a; });
}

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

  std::vector<int> array(n);
  for (auto& a : array) {
    std::cin >> a;
  }

  std::cout << std::setprecision(20) << solve(n, array) << std::endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
public class Main{
 
	public static void main(String[] $){
		Scanner s = new Scanner(System.in);
        long X = s.nextLong();
        List<Integer> factor = new ArrayList<Integer>();

        long A = 0;
        long B = 0;
        boolean check = false;
        for(int i = -130; i <=130; i++){
            for(int j = -130; j <=130; j++){
                A = i; B = j;
                if(X == A*A*A*A*A - B*B*B*B*B){
                    check = true;
                    break;
                }
            }
            if(check) break;
        }
        
        System.out.println(A + " " + B);
        
        
	}
} 

Measured memory_bytes: 38736
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long int ll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
const int MOD = 1000000007;
const int INF = INT_MAX;


int fact(int n){
    int a=1;
    for (int i=1; i <= n; i++){
        a *= i;
    }

    return a;
}

int main(int argc, char const *argv[])
{
    char c;
    cin >> c;

    char cc;
    cc = c + 1;

    cout << cc << endl;


    

    return 0;
}




//              g++ -std=c++1z  

Measured memory_bytes: 888
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
from heapq import heappop, heappush
def resolve():
    n, m, s = map(int,input().split())
    S = 0
    E = [[] for _ in range(n)]
    for _ in range(m):
        u, v, a, b = map(int,input().split()) # a : cost silver
        u -= 1; v -= 1
        S += a
        E[u].append((v, -a, b))
        E[v].append((u, -a, b))
    for v in range(n):
        c, d = map(int,input().split())
        E[v].append((v, c, d))

    # Dijkstra with heap
    dist = [[INF] * (S + 1) for _ in range(n)]
    s = min(s, S)
    dist[0][s] = 0
    heap = [(0, 0, s)] # dist, vertex, silver
    while heap:
        d, v, s = heappop(heap)
        if dist[v][s] < d:
            continue
        for nv, ds, dd in E[v]:
            ns = s + ds
            if not (0 <= ns <= S):
                continue
            if dist[nv][ns] > dist[v][s] + dd:
                dist[nv][ns] = dist[v][s] + dd
                heappush(heap, (dist[nv][ns], nv, ns))

    # output
    for v in range(1, n):
        print(min(dist[v][s] for s in range(S + 1)))
resolve()

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

struct Day{
	int y,m,d;
	Day(){}
	Day(int y,int m,int d):y(y),m(m),d(d){}
	bool operator<=(Day a){
		if(y!=a.y)return y<a.y;
		if(m!=a.m)return m<a.m;
		return d<=a.d;
	}
};

int main(){
	int y,m,d;
	char *gengo[]={"heisei","showa","taisho","meiji"};
	Day begin[4]={Day(1989,1,8),Day(1926,12,25),Day(1912,7,30),Day(1868,9,8)};
	while(cin>>y>>m>>d){
		int i;
		Day day(y,m,d);
		for(i=0;i<4;i++){
			if(begin[i]<=day){
				day.y -= begin[i].y-1;
				break;
			}
		}
		if(i==4)cout<<"pre-meiji\n";
		else cout<<gengo[i]<<' '<<day.y<<' '<<day.m<<' '<<day.d<<endl;
	}
	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	long long a;
	string s; cin>>a>>s;
	int b_ = (s[0] - '0') * 100 + (s[2] - '0') * 10 + (s[3] - '0');
	cout<<a * b_ / 100<<endl;
}

Measured memory_bytes: 3624
n = int(input())
s = input()
maxV = 0

for i in range(n):
    se = set()
    s1 = s[0:i]
    s2 = s[i:n]
    count = 0
    for j in s1:
        for k in s2:
            if j == k and not j in se:
                se.add(j)
                count += 1
        maxV = max(count, maxV)
print(maxV)


Measured memory_bytes: 3060
n = int(input())
a = [0] + list(map(int, input().split()))
balls = [0 for i in range(n+1)]

for i in range(1,n+1)[::-1]:
    ball_sum = sum(balls[i::i]) % 2
    if ball_sum ^ a[i]:
        balls[i] = 1

print(sum(balls))
ball_list = [str(k) for k, v in enumerate(balls) if v == 1 ]
print(" ".join(ball_list))

Measured memory_bytes: 17204
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;
//typedef boost::multiprecision::cpp_int bigint;

struct task {
	LL a, b, c, d;
};

LL N, M, Q;
vector<task> tasks;

LL calc(VLL& V) {
	LL ans = 0;
	for (LL q = 0; q < Q; q++) {
		LL a = tasks[q].a;
		LL b = tasks[q].b;
		LL c = tasks[q].c;
		LL d = tasks[q].d;
		if (V[b] - V[a] == c)ans += d;
	}
	return ans;
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	cin >> N >> M >> Q;
	tasks.resize(Q);
	for (LL q = 0; q < Q; q++) {
		cin >> tasks[q].a >> tasks[q].b >> tasks[q].c >> tasks[q].d;
		tasks[q].a--;
		tasks[q].b--;
	}
	LL ans = 0;
	VLL V(N,1);
	while (V[0] <= M) {
		ans = max(ans, calc(V));
		LL last = N - 1;
		while (V[last] == M) {
			last--;
			if (last == -1)goto answer;
		}
		V[last]++;
		for (LL n = last + 1; n < N; n++)V[n] = V[last];
	}
	answer:
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
//#define int long long
#define INF 10000000
using namespace std;
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
int main(){
    int n;
    cin >> n;
    if(n == 0) cout << 1 << endl;
    else if (n == 1) cout << 2 << endl;
    else if (n == 2) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 3092