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

public class Main {

	public static void main(String[] args) {
		sortThreeNumbers();

	}
	
	public static void sortThreeNumbers() {
		
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int swap;
		
		if (a > b) {
			swap = a;
			a = b;
			b = swap;
		}
		
		if (b > c) {
			swap = b;
			b = c;
			c = swap;
		}

		if (a > b) {
			swap = a;
			a = b;
			b = swap;
		}
		
		System.out.println(a + " " + b + " " + c);
	}
}


Measured memory_bytes: 26400
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  if (a[len(a) - 1] == b[0] && b[len(b) - 1] == c[0])
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

int main() {
	string s,t;
	string ans = "";
	int n;
	cin >> n;
	cin >> s >> t;
	rep(i,n) {
		ans.pb(s[i]);
		ans.pb(t[i]);
	}
	cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
class ReverseSequence{ 
    public:
        void solve(string str){ 
            int n=str.size();
            for(int i=n-1;i>=0;i--){ 
                printf("%c",str[i]);
            }
            printf("\n");
        }
};
int main(){ 
    string str;
    cin>>str;
    ReverseSequence inst;
    inst.solve(str);
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;

void test_case(){
	int n; cin >> n;
	int c1=0 , c2=0 , c3=0 , c4=0;
	for(int i = 0 ; i < n ; i++){
		string s; cin >> s;
		if(s=="AC")
			c1++;
		else if(s=="WA")
			c2++;
		else if(s=="TLE")
			c3++;
		else
			c4++;
		}
		cout<<"AC x "<<c1<<"\n";
				cout<<"WA x "<<c2<<"\n";

		cout<<"TLE x "<<c3<<"\n";

		cout<<"RE x "<<c4<<"\n";

}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<60;
double pi=3.141592653589793238462643383279L;
double eps=1e-8;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll a,b,c;cin>>a>>b>>c;
    if(c-a-b<=0){
        cout<<"No"<<endl;
        return 0;
    }
    ll f=(c-a-b)*(c-a-b);
    ll g=4*a*b;
    if(g<f)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}




Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int[] r = new int[n];
		for (int i = 0; i < 2 * m; i++)
			r[Integer.parseInt(sc.next()) - 1]++;
		for (int i = 0; i < n; i++)
			System.out.println(r[i]);
	}
}

Measured memory_bytes: 21844
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
int n;
long long ans,a,b,x[100009]; 
int main(){
	scanf("%d%lld%lld",&n,&a,&b);
	for(int i=1;i<=n;i++)scanf("%lld",&x[i]);
	for(int i=2;i<=n;i++)ans+=min(a*(x[i]-x[i-1]),b);
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define ALL(v) v.begin(),v.end()
#define mp make_pair
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}}
template <class X> void prrr(X test){int f=0;for(auto it:test){cout<<(f++!=0?" ":"")<<it;}cout<<endl;}
template<typename X>
istream&operator>>(istream&i,vector<X>&v){for(X&x:v)i>>x;return i;}

class UF { // union find from https://github.com/kartikkukreja/blog-codes (MIT)
    // [usage]
    // auto uf = new UF(n);
    // uf->merge(l, r); // 0 <= l, r <= n-1
    // ...
public:
    int *id; // inner id
    int cnt; // number of all vartices
    int *sz; // sz[i] means size of i's set
    UF(int N)   {
        cnt = N;
        id = new int[N];
        sz = new int[N];
        for(int i=0; i<N; i++) {
            id[i] = i;
            sz[i] = 1;
        }
    }
    ~UF() {
        delete [] id;
        delete [] sz;
    }
    int find(int p) {
        int root = p;
        while (root != id[root]) root = id[root];
        while (p != root) {
            int newp = id[p];
            id[p] = root;
            p = newp;
        }
        return root;
    }
    void merge(int x, int y) {
        int i = find(x);
        int j = find(y);
        if (i == j) return;
        
        if (sz[i] < sz[j]) {
            id[i] = j;
            sz[j] += sz[i];
        } else {
            id[j] = i;
            sz[i] += sz[j];
        }
        cnt--;
    }
    bool connected(int x, int y) {
        return find(x) == find(y);
    }
    int count() {
        return cnt;
    }
};

// return sorted 約数list 1 <= x <= n
vector<ll> divv(ll n) {
  vector<ll> v;
  for(ll i = 1; i*i <= n; i++) {
    if(n%i == 0) {
      v.push_back(i);
      if(i*i != n) v.push_back(n/i);
    }
  }
  sort(ALL(v));
  return v;
}

auto isprime = [](auto n){
  bool isPrime = true;
  for(decltype(n) i = 2; i <= sqrt(n); ++i)
  {
      if(n % i == 0)
      {
          isPrime = false;
          break;
      }
  }
  return isPrime;
};

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


    unordered_set<ll> divn,divk;
    // {
    //     ll lim = sqrt(n);
    //     fr(i, 1, lim+1){
    //         if(n%i ==0){
    //             divn.insert(i);
    //             divn.insert(n/i);
    //         }
    //     }
    // }
    auto y = divv(n);
    for(auto it:y){
        divn.insert(it);
    }
    {
        ll lim = sqrt(k);
        fr(i, 1, lim+1){
            if(k%i ==0){
                divk.insert(i);
                divk.insert(k/i);
            }
        }
    }
    ll sum=0;
    for(auto it:divk) if(divn.count(it)) if(isprime(it)) sum++;
    pr(sum);
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
 
ll MOD = 1000000007;
ll INF =1<<29;

int main() {
     int a,b;
     cin >> a>>b;
     for(int i = 1;i<=1250;++i){
             if(i*8/100==a&&i*10/100==b) {cout << i <<endl;
             return 0;} 
     }
     cout << -1 <<endl;
}

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

int main() {
  ll n;
  ll a;
  cin >> n;
  
  for (int i = 1; i <= sqrt(n) ; i++) {
    if (n % i == 0) {
      a = i;
    }
  }
  cout << a + n / a - 2 << endl;
}

Measured memory_bytes: 384
// inputに入力データ全体が入る
function Main(input) {
    // 入力を解釈
	input = input.split("\n");
	tmp0 = input[0];
	tmp1Array = input[1].split(" ");
	tmp2Array = input[2].split(" ");
	
	var length = tmp1Array.length;
	var totalValue = 0;
	for(var i = 0 ; i <= length ; i++){
	    var temp = tmp1Array[i] -  tmp2Array[i];
	    
	    if(temp > 0){
	        totalValue += temp;
	    }
	}

    
	
	// 文字を10進数に変換
	// var a = parseInt(input[0], 10);


	//出力
	console.log(totalValue);
}

var counter = function(str,seq){
    return str.split(seq).length - 1;
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    void solve()
    {
        int N = cin.nextint;
        var A = cin.scanint;
        WriteLine(A.Max() - A.Min());
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}                               

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a, v, b, w;
    cin >> a >> v >> b >> w;
    ll t;
    cin >> t;
    if (a > b) {
        swap(a, b);
    }
    a += v * t;
    b += w * t;
    if (a < b) {
        cout << "NO" << '\n';
    } else {
        cout << "YES" << '\n';
    }
    return 0;
}

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

using namespace std;

int main(){
    int x;
    cin >> x;
    vector<bool> DP(100110);
    for (int i = 100; i <= 105; i++)
        DP[i] = true;

    for (int i = 0; i < x; i++){
        for (int j = 100; j <= 105; j++){
            DP[i + j] = DP[i + j] or DP[i];
        }
    }

    cout << DP[x] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repl(i, l, r) for (int i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int, int>;

int main()
{
    int n;
    cin >> n;
    int ans = 0;
    rep(i, n) {
        ll a;
        cin >> a;
        while(a % 2 == 0) {
            ans++;
            a /= 2;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
def gcd(x, y):
  x, y=max(x, y), min(x, y)
  while y:
    x, y=y, x%y
  return x

N=int(input())
A=list(map(int, input().split()))
left_gcd=[1 for i in range(N)]
left_gcd[0]=A[0]
right_gcd=[1 for i in range(N)]
right_gcd[-1]=A[-1]
for i in range(1, N):
  left_gcd[i]=gcd(left_gcd[i-1], A[i])
for i in range(N-2, -1, -1):
  right_gcd[i]=gcd(right_gcd[i+1], A[i])
maxv=max(left_gcd[-2], right_gcd[1])
for i in range(1, N-1):
  maxv=max(maxv, gcd(left_gcd[i-1], right_gcd[i+1]))
print(maxv)

Measured memory_bytes: 14584
#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>

using namespace std;

struct CityInfo {
	int state_id;
	int year;
	int idx;

	bool operator<(const CityInfo& rhs) const {
		return year < rhs.year;
	}
};

int main (int argc, char* argv[]) {

	int state_num, city_num;
	cin >> state_num >> city_num;

	vector<vector<CityInfo*>> states(state_num + 1);
	vector<CityInfo*> cities(city_num + 1);

	for (int i = 0; i < city_num; i++) {
		int state_id, year;
		cin >> state_id >> year;
		auto city_info = new CityInfo { state_id, year, 0 };
		states[state_id].push_back(city_info);
		int city_id = i + 1;
		cities[city_id] = city_info;
	}

	for (int state_id = 1; state_id < states.size(); state_id++) {
		auto& state_cities = states[state_id];
		sort(state_cities.begin(), state_cities.end(), [](CityInfo* lhs, CityInfo* rhs) { return *lhs < *rhs; });
		for (int i = 0; i < state_cities.size(); i++) {
			state_cities[i]->idx = i + 1;
		}
	}

	for (int i = 1; i < cities.size(); i++) {
		auto* city = cities[i];
		cout << setfill('0') << setw(6) << city->state_id;
		cout << setfill('0') << setw(6) << city->idx << endl;
		delete city;
	}
}


Measured memory_bytes: 10880
fun main(main: Array<String>) {
    val (n, m ,c) = readLine()!!.split(" ").map { it.toInt() }
    val b = readLine()!!.split(" ").map { it.toInt() }
    var sum = 0
    var cnt = 0
    repeat(n) {
        sum = 0
        var a = readLine()!!.split(" ").map { it.toInt() }
        repeat(m) {
            sum += a[it] * b[it]
        }
        if (sum + c > 0) {
            cnt++
        }
    }
    print(cnt)
}

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

using namespace std;

int N;
int arr[22][22];
long long pre[1<<22];
long long dp[1<<22];
long long MOD = 1000000007;

int main(){
    cin >> N;
    for(int i = 0; i<N; i++){
        for(int j = 0; j<N; j++){
            cin >> arr[i][j];
        }
    }
    dp[0] = 1;
    for(int i = 1; i<1<<N; i++){
        int j = __builtin_popcount(i)-1;
        for(int k = 0; k<N; k++){
            if(arr[j][k] && ((1<<k)&i)){
                dp[i] += dp[i^(1<<k)];
            }
        }
        dp[i] %= MOD;
    }
    cout << dp[(1<<N)-1] << endl;
}


Measured memory_bytes: 18688
#include<iostream>
#include<string>
using namespace std;
struct Dice{
  int s[6];
  void roll(char c){
    int b;
    if(c=='E'){
      b=s[0];
      s[0]=s[3];
      s[3]=s[5];
      s[5]=s[2];
      s[2]=b;
    }
    if(c=='W'){
      b=s[0];
      s[0]=s[2];
      s[2]=s[5];
      s[5]=s[3];
      s[3]=b;
    }
    if(c=='N'){
      b=s[0];
      s[0]=s[1];
      s[1]=s[5];
      s[5]=s[4];
      s[4]=b;
    }
    if(c=='S'){
      b=s[0];
      s[0]=s[4];
      s[4]=s[5];
      s[5]=s[1];
      s[1]=b;
    }
    if(c=='R'){
      b=s[1];
      s[1]=s[2];
      s[2]=s[4];
      s[4]=s[3];
      s[3]=b;
    }    
  }
  int top() {
    return s[0];
  }
  int right(){
    return s[2];
  }
  int left(){
    return s[3];
  }
  int front(){
    return s[1];
  }
};
bool same(Dice a,Dice b){
  for(int i = 0; i < 6; i++) if(a.s[i]!=b.s[i]) return false;
  return true;
}
int main(){
  Dice d[2];
  for(int j = 0; j < 2; j++) 
    for(int i = 0; i < 6; i++)
      cin >> d[j].s[i];
  bool f = false;
  
  
  for(int i = 0; i < 4; i++){
    d[1].roll('R');
    for(int j = 0; j < 4; j++){
      d[1].roll('N');
      if(same(d[0],d[1])) f = true;
    }
  }
  d[1].roll('E');
  for(int j = 0; j < 4; j++){
    d[1].roll('N');
    if(same(d[0],d[1])) f = true;
  }

  d[1].roll('W');
  d[1].roll('W');
  for(int j = 0; j < 4; j++){
    d[1].roll('N');
    if(same(d[0],d[1])) f = true;
  }
  if(f)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}



Measured memory_bytes: 3124
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
typedef pair<int,P> PP;
struct edge { int to, cor; };
int a[105];
int dp[101][100004];
int n,k; 
int rwa[100005];
signed main() {
	cin >> n>>k;
	rep(i, n)cin >> a[i];
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		rep(j, k + 1)rwa[j + 1] = dp[i - 1][j];
		rep(j, k + 1)rwa[j + 1] += rwa[j];
		rep(j, k + 1) {
			int r = j;
			int l = max(0ll, j - a[i - 1]);
			dp[i][j] += rwa[r + 1] - rwa[l];
			dp[i][j] %= mod;
		}
	}
	cout << dp[n][k] << endl;
}

Measured memory_bytes: 79104
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

const int N_MAX = 50;
// グラフの形
bool graph[N_MAX][N_MAX];

// 訪問フラグ
bool visited[N_MAX];

void resetGraph(){
    FOR(i, 0, N_MAX){
        FOR(j, 0, N_MAX){
            graph[i][j] = false;
        }
    }

    FOR(i, 0, N_MAX){
        visited[i] = false;
    }
}

void dfs(int startId){
    // 訪問済みにする
    visited[startId] = true;

    // そこから行ける先
    auto flags = graph[startId];
    
    FOR(i, 0, N_MAX){
        if(flags[i]==true && visited[i]==false){
            dfs(i);
        }
    }
}

void printGraph(int N){
    FOR(i, 0, N){
        FOR(j, 0, N){
            if(graph[i][j]==true){
                cout << "1 ";
            }else{
                cout << "0 ";
            }
        }
        cout << endl;
    }
}

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

    // input
    int N, M;
    cin >> N >> M;

    vector<pair<int, int> > edges;

    // エッジ情報
    FOR(i, 0, M){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        auto p = make_pair(a, b);
        edges.push_back(p);
    }

    int bridgeNum = 0;
    // i: 除外するエッジ
    FOR(i, 0, M){
        resetGraph();
        
        FOR(j, 0, M){
            if(i!=j){
                auto edge = edges[j];
                graph[edge.first][edge.second] = true;
                graph[edge.second][edge.first] = true;
            }
        }

        // そのグラフに対して、DPFで全部visitedにできるかチェック
        dfs(0);

        bool allVisited = true;
        FOR(i, 0, N){
            if(visited[i]==false){
                allVisited = false;
            }
        }
        if(!allVisited){
            bridgeNum++;
        }
    }

    p(bridgeNum);
    
    return 0;
}

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

using namespace std;

namespace prob0582 {
	enum TriangleType { DoesNotExist = 0, RightAngle, Accute, Obtuse };

	TriangleType checkTriangleType(array<int, 3> edges)
	{
		int longest = 0;
		int longest2sq = 0;
		int sum = 0;
		int sumsq = 0;

		for (int i = 0; i < 3; ++i) {
			if (edges[i] > longest) longest = edges[i];
			sum += edges[i];
			sumsq += edges[i] * edges[i];
		}
		longest2sq = 2 * longest * longest;

		if (sum <= 2 * longest) return DoesNotExist;
		if (sumsq > longest2sq) return Accute;
		if (sumsq == longest2sq) return RightAngle;
		return Obtuse;
	}

	void solve(istream &sin, ostream &sout)
	{
		int total = 0;
		int eachType[]{ 0,0,0,0 };

		array<int, 3> edges;
		TriangleType type;

		do
		{
			sin >> edges[0] >> edges[1] >> edges[2];
			++total;
			type = checkTriangleType(edges);
			eachType[static_cast<int>(type)]++;
		} while (type != DoesNotExist);
		--total;

		sout << total;
		for (int i = 0; i < 3; ++i) sout << " " << eachType[i + 1];
		sout << endl;
	}
}

int main()
{
	prob0582::solve(cin, cout);
}


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

void Main() {
  int N;
  cin >> N;
  int a[N * 3];
  for (int i = 0; i < N * 3; i++) {
    cin >> a[i];
  }

  priority_queue<int, vector<int>, greater<int>> l;
  long long l_sum[N + 1];
  memset(l_sum, 0, sizeof(l_sum));
  for (int i = 0; i < N; i++) {
    l.push(a[i]);
    l_sum[0] += a[i];
  }
  for (int i = N; i <= N * 2; i++) {
    l.push(a[i]);
    l_sum[i - N + 1] = l_sum[i - N] + a[i] - l.top();
    l.pop();
  }

  priority_queue<int> r;
  long long r_sum[N + 1];
  memset(r_sum, 0, sizeof(r_sum));
  for (int i = N * 3 - 1; i >= N * 2; i--) {
    r.push(a[i]);
    r_sum[N] += a[i];
  }
  for (int i = N * 2 - 1; i >= N; i--) {
    r.push(a[i]);
    r_sum[i - N] = r_sum[i - N + 1] + a[i] - r.top();
    r.pop();
  }

  long long ans = -1e17;
  for (int i = 0; i <= N; i++) {
    ans = max(ans, l_sum[i] - r_sum[i]);
  }
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}



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

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;

    ll ans = n / (a + b) * a;
    ll rem = n % (a + b);
    ans += min(rem, a);

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<ll>::iterator sit;
typedef map<ll,ll>::iterator mit;


int dp[1000001];
int dp2[1000001];

ll solvenaive(int n, int k)
{
	for(int i=0;i<k;i++)
	{
		dp[i]=dp2[i]=0;
	}
	for(int i=k;i<=n;i++)
	{
		set<int> S;
		for(int j=1;j<=i/k;j++)
		{
			S.insert(dp[i-j]);
		}
		for(int j=0;;j++)
		{
			if(S.find(j)==S.end())
			{
				dp[i] = j; break;
			}
		}
	}
	for(int i=k;i<=n;i++)
	{
		if(i%k==0) dp2[i] = i/k;
		else dp2[i] = dp2[(ll(k-1)*i)/k];
	}
	for(int i=0;i<=n;i++)
	{
		assert(dp[i]==dp2[i]);
		cerr<<i<<' '<<dp[i]<<' '<<dp2[i]<<'\n';
	}
	return dp2[n];
}



ll solvesmall(ll n, ll k)
{
	//cerr<<n<<' '<<k<<'\n';
	if(k==1) return n;
	if(n<k) return 0;
	if(n%k==0) return n/k;
	return solvesmall(((k-1)*n)/k, k);
}

ll solvelarge(ll n, ll k)
{
	if(k==1) return n;
	/*
	for(ll id = 1; id*k<=n; id++)
	{
		queue<ii> Q;
		Q.push(mp(id*k, id*k));
		while(!Q.empty())
		{
			ll l = Q.front().fi; ll r = Q.front().se; Q.pop();
			cerr<<l<<' '<<r<<'\n';
			if(l<=n&&n<=r)
			{
				return id;
			}
			if(r>=n) continue;
			ll newl = (l*k + k - 2)/(k-1);
			ll newr = ((r+1)*k - 1)/(k-1);
			for(ll i = newl/k; i <= newr/k + 1; i++)
			{
				ll L = max(newl, i*k + 1); ll R = min(newr, (i+1)*k - 1);
				if(R>=L)
				{
					Q.push(mp(L,R));
				}
			}
		}
		cerr<<id<<'\n';
	}
	return 0;
	*/
	if(k==1) return n;
	if(n<k) return 0;
	if(n%k==0) return n/k;
	ll f = (n+k-1)/k;
	ll z = (n-k*(f-1)-1)/f;
	return solvelarge(n -(z+1)*f, k);
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int t; cin>>t;
	ll x=0;
	while(t--)
	{
		ll n,k; cin>>n>>k;
		x^=solvelarge(n,k);
	}
	cout<<(x==0?"Aoki":"Takahashi")<<'\n';
}


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

long long ceiling(long long a, long long b) {
    if (a == 0) {
        return 0;
    }
    return (a - 1) / b + 1;
}

int main() {
    long long n, a, b;
    cin >> n >> a >> b;
    long long h[n], begin = 1, end = 0;
    for (int i = 0; cin >> h[i]; i++) {
        end = max(end, h[i]);
    }
    while (begin < end) {
        long long mid = (begin + end) / 2, count = 0;
        for (long long i = 0; i < n; i++) {
            if (h[i] - mid * b > 0) {
                count += max(ceiling(h[i] - mid * b, a - b), 0ll);
            }
        }
        if (count <= mid) {
            end = mid;
        } else {
            begin = mid + 1;
        }
    }
    cout << begin;
    return 0;
}


Measured memory_bytes: 1024
list = []
while True:
    a = [int(i) for i in input().split()]
    if a[0] == 0 and a[1] == 0:
        break
    else:
        list.append(a)

for i in range(len(list)):
    for j in range(list[i][0]):
        if list[i][1] % 2 == 0:
            x = "#." * (list[i][1] // 2)
            y = ".#" * (list[i][1] // 2)
        else:
            x = "#." * (list[i][1] // 2) + "#"
            y = ".#" * (list[i][1] // 2) + "."

        if j % 2 == 0:
            print(x)
        else:
            print(y)
    print("")



Measured memory_bytes: 5628
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
// #define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};


ll n;
vll v,k;
map<ll,ll> mp;
void dfs(ll x){
    if(mp[x]>0) return ;
    mp[x]++;
    if(x>1000000000) return ;
    string s=to_string(x);
    ll m=s.size();
    v.pb(x*10+3);dfs(x*10+3);
    v.pb(x*10+5);dfs(x*10+5);
    v.pb(x*10+7);dfs(x*10+7);
    return ;
}


void solve(){
    cin>>n;
    ll s=LB(k,n);
    if(k[s]==n) s++;
    // cout<<n<<" "<<k[s]<<" ";
    cout<<s<<endl;
    return ;
}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    dfs(0);
    ERASE(v);
    ll m=v.size();
    rep(i,m){
        string s=to_string(v[i]);
        // if(i<100)cout<<s<<endl;
        ll cnt[4]={};
        rep(j,(ll)s.size()){
            if(s[j]-'0'==3) cnt[0]++;
            if(s[j]-'0'==5) cnt[1]++;
            if(s[j]-'0'==7) cnt[2]++;
        }
        if(cnt[0]>0&&cnt[1]>0&&cnt[2]>0){
            k.pb(v[i]);
            // if(i<100) cout<<v[i]<<endl;
        }
    }

    rep(_,1){
        solve();
    }

    return 0;
}


Measured memory_bytes: 8052
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n, a[100005];
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> n;
    rep(i, 0, n) cin >> a[i];
    ll sum = 0, ans1 = 0, ans2 = 0;
    rep(i, 0, n) {
        sum += a[i];
        if (i%2) {
            if (sum <= 0) {
                ans1 += abs(sum) + 1;
                sum = 1;
            }
        } else {
            if (sum >= 0) {
                ans1 += sum + 1;
                sum = -1;
            }
        }
    }
    sum = 0;
    rep(i, 0, n) {
        sum += a[i];
        if (i%2) {
            if (sum >= 0) {
                ans2 += sum + 1;
                sum = -1;
            }
        } else {
            if (sum <= 0) {
                ans2 += abs(sum) + 1;
                sum = 1;
            }
        }
    }
    cout << min(ans1, ans2) << endl;
    return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);

    string s;
    cin >> s;
    if (s == "ABC")
        cout << "ARC" << endl;
    else
        cout << "ABC" << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789) cout << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#define SIZE 30
#define CHANGEMAX 8

using namespace std;
bool ok(int *p);
void swap(int *p,int i,int j);
int solv(int now,int *p);

int main(){
  int n;
  int p[SIZE];
  cin>>n;
  for(int i=0;i<n;i++){
    for(int j=0;j<SIZE;j++)
      cin>>p[j];
    //cout<<ok(p)<<endl;
    cout<<solv(0,p)<<endl;
  }
  return 0;
}

int solv(int now,int *p){
  int tmp;
  int p_tmp_tmp[4][SIZE];
  int res[4];
 
  if(ok(p)==true){
    return now;
  }else if(now>CHANGEMAX){
    return CHANGEMAX+1;
  }

  for(int j=0;j<4;j++){
    res[j]=0;
    for(int i=0;i<SIZE;i++){
      p_tmp_tmp[j][i]=p[i];
    }
  }
  
  /*回転パターン1*/
  swap(p_tmp_tmp[0],17,12);
  swap(p_tmp_tmp[0],6,21);
  swap(p_tmp_tmp[0],8,23);
  swap(p_tmp_tmp[0],7,22);
  swap(p_tmp_tmp[0],9,11);
  /*回転パターン2*/
  swap(p_tmp_tmp[1],0,27);
  swap(p_tmp_tmp[1],1,28);
  swap(p_tmp_tmp[1],2,29);
  swap(p_tmp_tmp[1],14,15);
  swap(p_tmp_tmp[1],18,20);
  /*回転パターン3*/
  swap(p_tmp_tmp[2],0,23);
  swap(p_tmp_tmp[2],3,26);
  swap(p_tmp_tmp[2],6,29);
  swap(p_tmp_tmp[2],9,20);
  swap(p_tmp_tmp[2],17,15);
  /*回転パターン4*/
  swap(p_tmp_tmp[3],2,21);
  swap(p_tmp_tmp[3],5,24);
  swap(p_tmp_tmp[3],8,27);
  swap(p_tmp_tmp[3],11,18);
  swap(p_tmp_tmp[3],12,14);

  for(int i=0;i<4;i++)
    res[i]=solv(now+1,p_tmp_tmp[i]);

  if(res[0]<=res[1] && res[0]<=res[2]&& res[0]<=res[3]){
    for(int i=0;i<SIZE;i++)
      p[i]=p_tmp_tmp[0][i];
    return res[0];
  }else if(res[1]<=res[0] && res[1]<=res[2]&& res[1]<=res[3]){
    for(int i=0;i<SIZE;i++)
      p[i]=p_tmp_tmp[1][i];
    return res[1];
  }else  if(res[2]<=res[0] && res[2]<=res[1]&& res[2]<=res[3]){
    for(int i=0;i<SIZE;i++)
      p[i]=p_tmp_tmp[2][i];
    return res[2];
  }else{
    for(int i=0;i<SIZE;i++)
      p[i]=p_tmp_tmp[3][i];
    return res[3];
  }
}

bool ok(int *p){
  /* for(int i=0;i<SIZE;i++)
     cout<<p[i]<<" ";
     cout<<endl;
  */
  for(int i=1;i<9;i++){
    if(p[i-1]!=p[i])
      return false;
  }
  for(int i=10;i<12;i++){
    if(p[i-1]!=p[i])
      return false;
  }
  for(int i=13;i<15;i++){
    if(p[i-1]!=p[i])
      return false;
  }
  for(int i=16;i<18;i++){
    if(p[i-1]!=p[i])
      return false;
  }
  for(int i=19;i<21;i++){
    if(p[i-1]!=p[i])
      return false;
  }
  for(int i=22;i<30;i++){
    if(p[i-1]!=p[i])
      return false;
  }
  return true;
}

void swap(int *p,int i,int j){
  int temp=p[i];
  p[i]=p[j];
  p[j]=temp;
  return;
}

Measured memory_bytes: 1164
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
#include<iomanip>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

const double pi = 3.141592653589793;

int char_to_int(char c)
{
	if (c == '0') return 0;
	if (c == '1') return 1;
	if (c == '2') return 2;
	if (c == '3') return 3;
	if (c == '4') return 4;
	if (c == '5') return 5;
	if (c == '6') return 6;
	if (c == '7') return 7;
	if (c == '8') return 8;
	if (c == '9') return 9;
	else return -1;
}

/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/



int main()
{
	long int r, D;
	long int x[15];
	cin >> r >> D >> x[0];

	for (int i = 0; i < 10; i++)
	{
		x[i + 1] = r * x[i] - D;
	}

	for (int i = 0; i < 10; i++)
	{
		cout << x[i + 1] << endl;
	}

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();
        string s = sc.NextString();
        string acgt = "ACGT";
        
        int max = 0;
        int head = 0;
        int count = 0;
        while (head < s.Length)
        {
        	if (acgt.IndexOf(s[head++]) == -1)
        	{
        		if (count > max) max = count;
        		count = 0;
        		continue;
        	}
        	count++;
        }
        Console.WriteLine(Math.Max(max, count));
    }
}

class Scanner
{
    int index = -1;
    string[] buf;

    public Scanner()
    {
    }

    public int NextInt()
    {
        CheckNext();
        return int.Parse(buf[index++]);
    }
        
    public long NextLong()
    {
    	CheckNext();
    	return long.Parse(buf[index++]);
    }

    public string NextString()
    {
        CheckNext();
        return buf[index++];
    }

    private void CheckNext()
    {
        if (index >= 0 && index < buf.Length) return;

        buf = Console.ReadLine().Split(' ');
        index = 0;
    }
}

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

int main(){
  int h,n;
  cin>>h>>n;
  vector <int> v(n);
  
  for(int i=0;i<n;i++)
    cin>>v[i];
  
  int sum=0;
  sum=accumulate(v.begin(),v.end(),0);
  if(sum>=h)
    cout<<"Yes";
  else
    cout<<"No";
  
  return 0;
}


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

using Vi = vector<int>;
using Vs = vector<string>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef pair<int, int> P;
typedef long long ll;

const int INF = 10000000, MAX_N = 100000, MAX_M = 1000, MAX_W = 10000;

int compare_char(const void* left, const void* right) {

    const char* left_char = *(const char**)left;
    const char* right_char = *(const char**)right;

    return strcmp(left_char, right_char);
}


int main() {
    int n, h, x = 0;
    cin >> h >> n;
    int a[MAX_N];
    rep(i, n)
        cin >> a[i];
    rep(i, n)
        x += a[i];
    if (x >= h)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String  T = sc.next();
		int A = sc.nextInt();
		int B = sc.nextInt();
		String U = sc.next();
		if(U.equals(S)) A--;
		else B--;
		System.out.println(A+ " "+B);
	}
}

Measured memory_bytes: 21844
// AGC20-A.cpp : アプリケーションのエントリ ポイントを定義します。
//

#include <iostream>
using namespace std;

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	cout << ((b - a) % 2 == 0 ? "Alice" : "Borys") << endl;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <time.h>
#include <stdarg.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <functional>
#include <map>

#define ll long long

using namespace std;

void
solve() {
  ll n, k;
  cin>>n>>k;

  vector<ll> h(n, 0);
  for (ll i=0; i<n; i++)
    cin>>h[i];

  vector<ll> value(n, 0);
  value[0] = 0;
  for (ll i=1; i<n; i++) {
    ll bottom = value[i-1] + abs(h[i] - h[i-1]);
    for (ll j=2; j<=k; j++)
      if (i-j >= 0)
        bottom = min(bottom, value[i-j] + abs(h[i] - h[i-j]));
    value[i] = bottom;
  }
  cout<<value[n-1]<<endl;
}

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

  ll t = 1;
  //cin>>t;

  while (t > 0) {
    t--;
    solve();
  }

  return 0;
}



Measured memory_bytes: 4788
#include<bits/stdc++.h>
#define ll long long
#define w cout
#define e endl
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin >> n;
    ll arr[n];
    ll gcd = 0 , ans = 1;
    for(int i = 0; i < n ;i ++ ) {
        cin >> arr[i];
        ans += (arr[i] - 1);
    }
    w << ans - 1;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int t;

int main(){
	cin>>t;
	cout<<3*t*t<<endl;
}

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

public class Main {
    FastScanner in;
    PrintWriter out;

    void solve() {
        long a = in.nextLong();
        long b = in.nextLong();
        long c = in.nextLong();
        long k = in.nextLong() % 2;
        if (k % 2 == 1) {
            long na = b + c;
            long nb = a + c;
            a = na;
            b = nb;
        }
        out.println(a - b);
    }

    void run() {
        try {
            in = new FastScanner(new File("Main.in"));
            out = new PrintWriter(new File("Main.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }

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

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

Measured memory_bytes: 23124
/*
ID: jerrywcy
TASK: AtCoder ABC 103 Problem B
LINK: https://abc103.contest.atcoder.jp/tasks/abc103_b
LANG: C++
*/
#include <bits/stdc++.h>

using namespace std;

string s,t;
int n;

void rot(string &str){
	str=str.substr(n-1)+str.substr(0,n-1);
}

int main()
{
	cin>>s;
	cin>>t;
	n=s.size();
	int i,j;
	for (i=0;i<n;i++){
		if (s==t){
			cout<<"Yes"<<endl;
			return 0;
		}
		rot(s);
	}
	
	cout<<"No"<<endl;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;

int main(){
    ll n ; cin >> n;
    vector<ll> v(n);
    rep(i,n) cin >> v.at(i);

    map<int,int> mpo,mpe;
    ll mpomax=0,mpemax=0,mpoidx,mpeidx;
    rep(i,n){
        if(i%2==1){//奇数
            mpo[v.at(i)]++;
            if(mpo[v.at(i)]>mpomax){
                mpomax = mpo[v.at(i)], mpoidx = v.at(i);
            }
        }else{//偶数
            mpe[v.at(i)]++;
            if(mpe[v.at(i)]>mpemax){
                mpemax = mpe[v.at(i)], mpeidx = v.at(i);
            }
        }
    }
    mpo.erase(mpoidx);
    mpe.erase(mpeidx);
    ll mposec = 0, mpesec = 0;
    for(auto i:mpo){
        if(i.second>mposec) mposec = i.second;
    }
    for(auto i:mpe){
        if(i.second>mpesec) mpesec = i.second;
    }
    ll ans;
    if(mpoidx == mpeidx){
        ans = n - max(mpomax+mpesec,mposec+mpemax);
    }else{
        ans = n - mpomax - mpemax;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5760
line = raw_input()
line = line.split(" ")
N,H,W = line
N = int(N)
H = int(H)
W = int(W)
ans = 0

for i in range(N):
    line = raw_input()
    line = line.split(" ")
    hi,wi = line
    hi = int(hi)
    wi = int(wi)

    if hi >= H and wi >= W:
        ans += 1
        
print ans

Measured memory_bytes: 2692
#include <stdio.h>
#include <limits.h>
int main(void)
{
    long int n, a[10*10*10*10*10*10], ans, cnteven[10*10*10*10*10*10], i;
    long int cntodd[10*10*10*10*10*10], maxeven=0, maxodd=0, max=0,
        evenidx, oddidx;
    long int maxodd2=0, maxeven2=0;
    scanf("%ld", &n);
    for(i=0;i<n;i++){
        scanf("%ld", &a[i]);
        if(a[i]>max) max=a[i];
    }

    for(i=0;i<n;i++){
        if(i%2==0) cnteven[a[i]]++;
        else cntodd[a[i]]++;
    }

    for(i=0;i<=max;i++){
        if(maxeven<cnteven[i]){
            maxeven2=maxeven;
            maxeven=cnteven[i];
            evenidx=i;
        }
        else if(maxeven2<cnteven[i]){
            maxeven2=cnteven[i];
        }
        if(maxodd<cntodd[i]){
            maxodd2=maxodd;
            maxodd=cntodd[i];
            oddidx=i;
        }
        else if(maxodd2<cntodd[i]){
            maxodd2=cntodd[i];
        }
    }

    if(oddidx != evenidx) ans=n-maxeven-maxodd;
    else if(n-maxodd-maxeven2<n-maxodd2-maxeven) ans=n-maxodd-maxeven2;
    else ans=n-maxodd2-maxeven;
    
    printf("%ld\n", ans);
    return 0;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
int n;
int x[200010],y[200010];
int a[200010],b[200010];
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x[i]>>y[i];
		a[i]=x[i]-y[i];
		b[i]=x[i]+y[i];
	}
	sort(a,a+n);
	sort(b,b+n);
	cout<<max(a[n-1]-a[0],b[n-1]-b[0])<<endl;
	return 0;
}

Measured memory_bytes: 6760
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


struct StronglyConnectedComponents{
    vector<int> used,cmp,vs;
    vector<vector<int>> v,rv;
    StronglyConnectedComponents(int n):used(n),cmp(n,-1),v(n),rv(n){}

    void add_edge(int x,int y){
        v[x].push_back(y);
        rv[y].push_back(x);
    }
    void dfs(int x){
       used[x]=true;
       for(auto to:v[x])if(!used[to])dfs(to);
       vs.push_back(x);
    }

    void rdfs(int x,int k){
       cmp[x]=k;
       for(auto to:rv[x])if(cmp[to]==-1)rdfs(to,k);
    }

    int scc(){
        rep(i,used.size())if(!used[i])dfs(i);
       reverse(vs.begin(),vs.end());
       int k=0;
       for(auto x:vs)if(cmp[x]==-1)rdfs(x,k++);
       return k;
    }
    vector<vector<int>> build(){
       int k=scc();
       vector<vector<int>> g(k);
       rep(i,v.size()){
           for(auto& to:v[i]){
               int x=cmp[i],y=cmp[to];
               if(x!=y)g[x].push_back(y);
           }
       }
       return g;
    }
};
int main(){
    int n,m;
    cin>>n>>m;
    string s;
    cin>>s;
    StronglyConnectedComponents scc(2*n);
    rep(i,m){
        int x,y;
        cin>>x>>y;
        --x;--y;
        if(s[x]==s[y]){
            scc.add_edge(x,y+n);
            scc.add_edge(y,x+n);
        }
        else {
            scc.add_edge(x+n,y);
            scc.add_edge(y+n,x);
        }
    }
    vector<vector<int>> ret;
    cout<<(scc.scc()==2*n?"No":"Yes")<<endl;
    return 0;
}

Measured memory_bytes: 40696