akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      	int c = a - b *2;
      	if(c<=0)c=0;
      	System.out.println(c);
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RS(x) rsort(x.begin(),x,end()))
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define pb push_back
#define pob pop_back
#define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
int INF = 1e9 + 1;
int MOD = 1e9+7;
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
signed main(){
   int  a,b;
cin >> a >> b;
   if(a%2==0){
       cout<<"No";
     return 0;
   }else if(b%2==0){
    cout << "No";
}else{
    cout << "Yes";
}
}

Measured memory_bytes: 256
import java.util.*;

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

    int n = sc.nextInt();
    int[] p = new int[n];
    int flg = 0;
    String ans = "NO";

    for(int i = 0; i < n; i++){
      p[i] = sc.nextInt();
      if(p[i] != i + 1){
        flg += 1;
      }
    }

    if(flg == 0 || flg == 2){
      ans = "YES";
    }

    System.out.println(ans);
  }
}


Measured memory_bytes: 23764
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const N = Number(input[0][0]);
  const S = Number(input[0][1]);
  const A = input[1].map(Number);
  const MOD = 998244353;

  const dp = [...Array(N + 1)].map(() => Array(S + 1).fill(0));
  dp[0][0] = 1;

  for (let i = 0; i < N; i++) {
    for (let j = 0; j <= S; j++) {
      dp[i + 1][j] += dp[i][j] * 2;
      dp[i + 1][j] %= MOD;

      if (A[i] + j <= S) {
        dp[i + 1][A[i] + j] += dp[i][j];
        dp[i + 1][A[i] + j] %= MOD;
      }
    }
  }

  return dp[N][S];
};

console.log(main(read()));


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

int main() {
  string S;
  cin >> S;
  
  int ans = 700;
  
  for (int i = 0; i < 3; i++) {
    if (S.at(i) == 'o') ans += 100;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
#include<cmath>
using namespace std;
#define LL long long

int main()
{
    string s;
    while(cin >> s)
    {
        int flag = 1;
        if(s.size() < 4) flag = 0;
        else
        {
            if(s[0] != 'Y' || s[1] != 'A' || s[2] != 'K' || s[3] != 'I')
                flag = 0;
        }
        if(flag)
            cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}


Measured memory_bytes: 256
# D - Integer Cards

import heapq
from collections import Counter

n, m = map(int, input().split())
A = list(int(x)*-1 for x in input().split())

C = Counter(A)
L = list(C.items())

for j in range(m):
    b, c = map(int, input().split())
    L.append((-c, b))

heapq.heapify(L)

ans = 0
for i in range(n):
    p, q = heapq.heappop(L)
    ans += p
    if q>1:
        heapq.heappush(L, (p, q-1))

print(ans*-1)

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

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  map<int, int> mp;
  rep(i, n) {
    int aa = a.at(i);
    mp[aa + 1]++;
    mp[aa]++;
    if (aa != 0) {
      mp[aa - 1]++;
    }
  }
  vector<int> cnt;
  for (auto &aaa : mp) {
    cnt.emplace_back(aaa.second);
  }
  sort(cnt.rbegin(), cnt.rend());

  cout << cnt.at(0) << endl;

  return 0;
}


Measured memory_bytes: 5756
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 
 using namespace std;
 
 int main()
 {
   double x1,y1,x2,y2,xq,yq;
   char temp1,temp2,temp3,temp4,temp5;
   while(cin>>x1>>temp1>>y1>>temp2>>x2>>temp3>>y2>>temp4>>xq>>temp5>>yq)
   {
     double xr,yr;
     if(x1==x2)   
     {
       xr=2*x1-xq;
       yr=yq;             
     }       
     else if(y1==y2)
     {
       xr=xq;
       yr=2*y1-yq;     
     }            
     else
     {
       double k=(y2-y1)/(x2-x1);
       double b=y1-(y2-y1)/(x2-x1)*x1;
       xr=(xq*(x2-x1)/(y2-y1))+yq-k*xq-2*b+yq;
       xr=xr/(k+(x2-x1)/(y2-y1));  
       yr=-(x2-x1)/(y2-y1)*(xr-xq)+yq;
     }             
     printf("%.6lf %.6lf\n",xr,yr);
   }
   //while(1);
   return 0; 
 }

 

Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
#define __ <<' '<<
#define ___ <<' '
#define bash push_back
#define ALL(x) x.begin(),x.end()
//#define int long long

struct IoSetup {IoSetup() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout <<fixed<<setprecision(12);
    cerr <<fixed<<setprecision(12);
}}IoSetup;

using ll = long long;
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int SMOD = 1000000007;
constexpr int NMOD = 998244353;
constexpr int dx[]={1,0,-1,0,1,1,-1,-1};
constexpr int dy[]={0,1,0,-1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a<b?a=b,true:false);}
template<class T>bool chmin(T &a, const T &b){return(a>b?a=b,true:false);}
inline int qp(int a,ll b,int mo){ll ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int c[20], a[20][20], sum[20];

signed main() {

    int n, m, x;

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

    int mini = INF;

    for(int bit = 0; bit < (1 << n); bit++) {
        int t = 0;
        memset(sum, 0, sizeof(sum));
        for(int i = 0; i < n; i++) {
            if((bit>>i)&1) {
                t += c[i];
                for(int j = 0; j < m; j++)
                    sum[j] += a[i][j];
            }
        }
        bool f = true;
        for(int i = 0; i < m; i++) {
            if(sum[i] < x) f = false;
        }
        if(f)
            chmin(mini, t);
    }
    if(mini == INF) mini = -1;
    cout << mini << endl;
  
    return 0;
}



Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {

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

		for (int i = 0; i < n; i++) {
			sum += 1 / sc.nextDouble();
		}
		System.out.println(1 / sum);
	}
}


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

using namespace std;

//連続したn個の整数の和は(1+2+...+n)+x*n (0<=x) で表せる、またx+1は連続した和の最初の数とみなせる
//(上記の式)=n*(1+n)/2+x*n=b なので n<=(-1+sqrt(8b+1))/2 となる
//最大だいたいn=50000ないくらい
int main() {
  long long b;
  while(cin >> b && b){
    pair<int,int> ans=make_pair(b,1);
    for(int i=2;i<50000;++i){
      long long sum=i*(1+i)/2;
      if(sum>b) break;
      long long dif=b-sum;
      if(dif%i==0) ans=make_pair(dif/i+1,i);
    }
    cout << ans.first << " " << ans.second << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3104
N, K = map(int, input().split())
if N <= K:
    while True:
        if N > abs(N - K):
            N = abs(N - K)
        else:
            break
else:
    N = N % K + K
    while True:
        if N > abs(N - K):
            N = abs(N - K)
        else:
            break
print(N)

Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

int main(){
  ll ma=0,sum=0;
  for(int i=0;i<5;i++){
    ll a;cin>>a;
    sum+=(a+9)/10*10;
    a%=10;
    a=10-a; a%=10;
    ma=max(ma,a);
  }
  cout<<sum-ma<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>

#define reps(i,j,k) for(int i=(j);i<(k);i++)
#define rep(i,j) reps(i,0,j)
#define INF (1<<28)
#define mk make_pair
#define fs first
#define sc second
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

int n,m,s,g,h;

int v[100][100];

template<class T>
ostream &operator<<(ostream &out, const vector<T> &v){
	out << "{";
	rep(i,v.size()) out << v[i] << ",";
	out << "}" << endl;
}

int main(){
	while(cin >> n >> m >> s >> g >> h, n){
		rep(i,100)rep(j,100) v[i][j] = i==j?0:INF;
		int ans = INF;
		s--; g--; h--;
		rep(i,m){
			int x, y, c;
			cin >> x >> y >> c;
			v[x-1][y-1] = c;
		}
		
		rep(k,n) rep(i,n) rep(j,n) v[i][j] = min(v[i][j], v[i][k] + v[k][j]);
		
		rep(i,n){
			ans = min (ans, v[s][i] + v[i][g] + v[i][h]);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
float dis;
int main()
{
    int n, d, count=0, res, k;
    cin>>n>>d;

    int arr[n][d], i, j;

    for(i=0; i<n; i++){
        for(j=0; j<d; j++){
            cin>>arr[i][j];
        }
    }


    for(i=0; i<n-1; i++){

        for(k=i+1; k<n; k++){
            dis = 0;
            for(j=0; j<d; j++){
                res = abs(arr[i][j] - arr[k][j])*abs(arr[i][j] - arr[k][j]);
                dis = dis + res;
            }
            dis = sqrt(dis);
            if(dis == int(dis)){
                count++;

            }


        }
    }

    cout<<count;
}


Measured memory_bytes: 256
import math
from functools import reduce
K = int(input())

def gcd(*nums):
    return reduce(math.gcd, nums)

s = 0
for a in range(1,K+1):
    for b in range(1,a+1):
        for c in range(1,b+1):
            if a == b and b == c:
                s += gcd(a,b,c)
            elif a == b or a == c or b == c:
                s += gcd(a,b,c) * 3
            else:
                s += gcd(a,b,c) * 6
print(s)


Measured memory_bytes: 9632
package main
 
import (
  "fmt"
  "os"
  "bufio"
  "strings"
)
 
func main() {
  var n int
  fmt.Scan(&n)
  scanner := bufio.NewScanner(os.Stdin)
  scanner.Scan()
  str := scanner.Text()
  strList := strings.Split(str, "")
  
  arr := [26]string{"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"}
  
  for i := range strList {
    for j := 0; j < 26; j++ {
      if strList[i] == arr[j] {
        fmt.Print(arr[(n+j) % 26])
        continue
      }
    }
  }
}


Measured memory_bytes: 1024
/*
    author : Divyansh Gupta
*/

#include <iostream>
#include <iomanip>
#include <cstring>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <utility>
#include <map>

using namespace std;

void print_err() {
	cerr<<"\n";
}

template <class T,class... Arg>
void print_err(T x,Arg&&... args) {
	cerr<<x<<" ";
	print_err(args...);
}

#ifdef local
#define debug(...) print_err(__VA_ARGS__)
#else
#define debug(...)
#endif

#define test_case int test_cases;\
                cin>>test_cases;\
                while(test_cases--)
#define lu(var,l,r) for(var=l;var<r;var++)
#define ld(var,r,l) for(var=r;var>=l;var--)
#define ll long long
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>                	
#define br cout<<"\n"
#define sp cout<<" "
#define pr cout<<
#define in cin>>
#define f first
#define s second                    
#define mod 1000000007
            
void solve(){
	int n,k,i,j,x;
	in n;
	in k;
	vi A,dp(k+1,0);
	lu(i,0,n) {
		in x;
		A.pb(x);
	}
	lu(i,1,k+1) {
		for(int x : A) {
			if(i - x >= 0) {
				if(dp[i - x] == 0) {
					dp[i] = 1;
				}
			}
		}
		debug("dp for",i,"is",dp[i]);
	}
	string ans = dp[k] == 1 ? "First" : "Second";
	pr ans;
	br;
}

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

Measured memory_bytes: 640
#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;
 
#define ff                  first
#define ss                  second
#define endl                "\n"
#define loop(i,s,e)         for(int i=s;i<e;i++)
#define int                 long long
#define vi                  vector<int> 
#define S(v)                sort(v.begin(),v.end())
#define RS(v)               sort(v.rbegin(),v.rend())
#define R(v)                reverse(v.begin(),v.end())
#define mxpq(T)             priority_queue <T>
#define mnpq(T)             priority_queue<T,vector<T>,greater<T>>
#define prv(v)              for(auto &x : v)cout << x << " ";
#define piirv(v)            for(auto &x : v)cout << x.ff << " " << x.ss << endl;
#define prvv(v)             for(auto &x : v)for(auto &y : x.ss)cout << y << " ";
#define mp                  make_pair
#define pii                 pair<int,int>
#define mset(a,f)           memset(a , f , sizeof(a))
#define pb                  push_back
#define inf                 INT_MAX
#define INF                 LLONG_MAX
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
 
const int N = 2e6 + 6;
const int M = 1e9+7;
int A[N];
int pre[N];
int n , m;

inline int mul(int a, int b) { return (a * b) % M; };
inline int add(int a, int b)
{
      int res = a + b;
      if ( res < 0 ) res += M;
      if ( res >= M) res -= M;
      return res;
}

void solve()
{

	cin >> n;

	loop(i,0,n)
	{
		cin >> A[i];
		if(i > 0)pre[i] += pre[i-1] + A[i-1]; 
	}

	int ans = 0;

	loop(i,0,n)
	{
		int a = A[i];
		a = ((a%M)*(pre[i]%M))%M;
		ans = (ans%M +  a%M)%M;
		// ans =% M;
	}

	cout << (ans%M);

}			
 
int32_t main()
{
 
cout<<fixed<<setprecision(16);
 
ios_base:: sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
 	
 
 	int t = 1;
 	// cin >> t;
 	while(t--)solve();
  
}

Measured memory_bytes: 6776
N = int(input())
A = list(map(int, input().split()))
B = [0]*(N+1)
x = []

for n in range(N):
  i = N-n
  BB = B[::i]
  if (sum(BB))%2 == A[i-1]:
    B[i] = 0
  else:
    B[i] = 1
    x.append(str(i))
  
if len(x) == 0:
  print(0)
else:
  print(len(x))
  print(' '.join(x))

Measured memory_bytes: 19396
#include <iostream>
using namespace std;
int main() {
 
  int N, L, aji, i, K, min;
  cin >> N >> L;
  aji = 0;
  min = 300;
  for(i=1; i<=N; i++){
     	K = L + i - 1;
    	aji = aji + K;
    if(abs(min) > abs(K)){
      min = K;
    }
      
  }
	cout << aji - min<<endl;
}



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

int main() {
    string s,t;
    cin>>s>>t;
    int n = s.length();
    int m = t.length();
    vector<int> arr[26];
    int cnta[26]={0}, cntb[26] = {0};
    for(int i=0;i<n;i++){
        cnta[s[i] - 'a']++;
        arr[s[i] - 'a'].push_back(i);
    }
    for(int i=0;i<m;i++){
        cntb[t[i] - 'a']++;
    }
    for(int i=0;i<26;i++){
        if(cntb[i] > 0 && cnta[i] == 0){
            cout<<"-1\n";
            return 0;
        }
    }
    int i = 0;
    lli fin_ans = 0;
    int index = -1;
    int last = -1;
    while(i < m){
        int x = t[i] - 'a';
        int s = 0, e = (int)arr[x].size()-1, mid,ans=-1;
        while(s <= e){
            mid = (s+e)/2;
            if(arr[x][mid] > last){
                ans = mid;
                e = mid - 1;
            }else{
                s = mid + 1;
            }
        }
        if(ans == -1){
            fin_ans += n;
            last = -1;
        }else{
            last = arr[x][ans];
            i++;
        }
        if(i == m){
            if(ans != -1){
                fin_ans += (arr[x][ans] + 1);
            }
        }
        //cout<<fin_ans<<" "<<last<<"\n"; 
    }
    cout<<fin_ans<<"\n"; 
    return 0;
}


Measured memory_bytes: 1216
def f(x):
    if x == 2:
        return 1
    if x < 2 or x % 2 == 0:
        return 0
    i = 3
    while i <= x ** (1/2):
        if x % i == 0:
            return 0
        i += 2
    return 1
while True:
    n = int(input())
    if n == 0:
        break
    else:
        a = 0
        for i in range(1, n // 2 + 1):
            m = n - i
            if f(m) == 1 and f(i) == 1:
                a += 1
        print(a)


Measured memory_bytes: 5640
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod107 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1)

const ll INF = 10010001010;
const int inf = 1000034000;
typedef vector<ll> vecl;
typedef vector<int> veci;
typedef tuple<string, int, int> TUP;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

vector<pair<long long, long long>> prime_factorize(long long N)
{
    vector<pair<long long, long long>> res;
    for (long long a = 2; a * a <= N; ++a)
    {
        if (N % a != 0)
            continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0)
        {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1)
        res.push_back({N, 1});
    return res;
}

uintmax_t combination(unsigned int n, unsigned int r)
{
    if (r * 2 > n)
        r = n - r;
    uintmax_t dividend = 1;
    uintmax_t divisor = 1;
    for (unsigned int i = 1; i <= r; ++i)
    {
        dividend *= (n - i + 1);
        divisor *= i;

    }
    return dividend / divisor;
}

int main()
{
    string S;
    cin >> S;
    int a, b, c;
    a = b = c = 0;
    for (int i = 0; i < S.size();i++)
    {
        if(S[i] == 'a'){
            a++;
        }
        else if(S[i] == 'b'){
            b++;
        }
        else{
            c++;
        }
    }
    /*if(a == 0 || b == 0 || c == 0){
        cout << "NO" << endl;
        return 0;
    }*/
    if(2 <= (max({a,b,c}) - min({a,b,c}))){
            cout << "NO" << endl;
            return 0;
    }
    cout << "YES" << endl;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F first
#define S second

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pi;

signed main() {
  IOS;
  int N;
  cin >> N;
  vector<pair<pair<string,int>,int>> res(N);
  FOR(i,0,N) {
    cin >> res[i].F.F >> res[i].F.S;
    res[i].S = i+1;
  }
  sort(res.begin(), res.end(),
       [&](pair<pair<string, int>,int>& a, pair<pair<string, int>,int>& b) {
         if (a.F.F == b.F.F) return a.F.S > b.F.S;
         return a.F.F < b.F.F;
       });

  for (auto r: res) {
    cout << r.S << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import collections

n = int(input())
s = input()
res = 0
# for i in range(0, n):
#     for j in range(i+1,n):
#         if s[i] != s[j]:
#             for k in range(j+1,n):
#                 if j-i!=k-j and s[i] != s[k] and s[j] != s[k]:
#                     res += 1
#
# print(res)
num = collections.Counter(s)
# print(num)
num_r = num["R"]
num_g = num["G"]
num_b = n - num_r - num_g
count_2 = 0
for x in range(1,int(n/2)+1):
    for i in range(n-2*x):
        # print(x)
        # print(i)
        # print()
        if (i + 2 * x < n and s[i] != s[i + x] and s[i + x] != s[i + 2 * x] and s[i] != s[i + 2 * x] ):
            count_2 += 1
            # print(x)
            # print(i)
            # print()

res = num_r * num_g * num_b - count_2
# print(num_r)
# print(num_g)
# print(num_b)
print(res)

Measured memory_bytes: 9404
#include <iostream>
#include <iomanip>
using namespace std;
int main(void){
    int a,b;
    cin >> a >> b;
    cout << a/b << " ";
    cout << a%b << " " << flush;
    cout << fixed << setprecision(6);
    cout << (double)a/(double)b << endl;
}


Measured memory_bytes: 3288
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    string s[100];
    set<string> q;
    for(int i = 0;i < n;i++){
        cin >> s[i];
        if(q.count(s[i]) != 0 || (i != 0 && s[i-1][s[i-1].size()-1] != s[i][0])){
            cout << "No" << endl;
            return 0;
        }
        q.insert(s[i]);
    }
    cout << "Yes" << endl;
}

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

num = 0

is_swapped = True
while is_swapped:
    is_swapped = False
    for i in range(n-1, 0, -1):
        if a[i] < a[i-1]:
            tmp = a[i]
            a[i] = a[i-1]
            a[i-1] = tmp
            is_swapped = True
            num += 1

print(' '.join([str(i) for i in a]))
print(num)


Measured memory_bytes: 5608
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){ return (int)s.size(); }

int main(){
    cout << fixed << setprecision(20);
    int n; cin >> n;
    vi s(n);
    int sum = 0;
    rep(i,n){
        cin >> s[i];
        sum += s[i];
    }
    if(sum % 10 != 0) cout << sum << endl;
    else {
        sort(s.begin(), s.end());
        for(int i: s){
            if(i % 10 != 0){
                cout << sum - i << endl;
                return 0;
            }
        }
        cout << 0 << endl;
    }
    return 0;
}

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

using namespace std;
void insertionSort(vector<int> &A,int N);
void PrintA(vector<int> &A,int N);

int main(){

    int N;
    
    cin >> N;

    vector<int> A(N);

    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    PrintA(A,N);

    insertionSort(A,N);

    return 0;
}

void PrintA(vector<int> &A,int N){

    for(int i=0;i<N;i++){
        cout << A[i];
        
        if(i == N-1){
            cout << endl;
        }
        else{
            cout << " ";
        }
    }
}

void insertionSort(vector<int> &A,int N){

    for(int i = 1; i < N; i++){

        int v = A[i];
        int j = i - 1;

        while (j >= 0 && A[j] > v){
            A[j+1] = A[j];
            j--; 

        }
    A[j+1] = v;
    PrintA(A,N);
    }  
}  



Measured memory_bytes: 3080
N = int(input())

temp = 0
ans = [0] * 100000
for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            temp = i*i + j*j + k*k + i*j + j*k + k*i
            ans[temp] += 1

for l in range(1,N+1):
    print(ans[l])



Measured memory_bytes: 10088
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int A,B,C;
  cin>>A>>B>>C;
  if(C-A+B>0){
  cout<<C-A+B<<endl;
  }
  else{
    cout<<0<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int c[3][3];
    rep(i,3) rep(j,3) cin >> c[i][j];
    int b1 = c[0][1]-c[0][0],b2 = c[0][2]-c[0][1];
    rep2(i,1,3) {
        if(c[i][1]-c[i][0] != b1) {
            cout << "No" << endl;
            return 0;
        }
        if(c[i][2]-c[i][1] != b2) {
            cout << "No" << endl;
            return 0;
        }
    }
    int a1 = c[1][0]-c[0][0],a2 = c[2][0]-c[1][0];
    rep2(i,1,3) {
        if(c[1][i]-c[0][i] != a1) {
            cout << "No" << endl;
            return 0;
        }
        if(c[2][i]-c[1][i] != a2) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
main :: IO ()
main = do
    s <- getLine
    putStrLn . show . solve $ s

solve :: String -> Int
solve = solve' . str2Bool

str2Bool :: String -> [Bool]
str2Bool s = map (\c -> if c == 'o' then True else False) s
    where
        f :: Char -> Bool
        f c
            | c == 'o' = True
            | otherwise = False

solve' :: [Bool] -> Int
solve' [] = 700
solve' (x:xs) = (if x then 100 else 0) + solve' (xs)

Measured memory_bytes: 380
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B = map(int, readline().split())

    if A > B:
        print(A + (A - 1))
    elif A < B:
        print(B + (B - 1))
    else:
        print(A + B)

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9120
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
ll gcd(ll a,ll b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
int modpow(ll a,ll n,int m){if(a==0)return a;ll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(int)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
int n, d[50];
int _tm(int a){
  if(a < 0) a+=24;
  return min(a, 24-a);
}
bool check(int a){
  vpii G[50][2];
  bool z[50][2], zz[50][2];
  Fill(z, false);
  FOR(i, 0, n-1)FOR(j, i+1, n){
    if(_tm(d[i]-d[j]) < a){
      G[i][0].pb(mp(j, 1));
      G[i][1].pb(mp(j, 0));
      G[j][0].pb(mp(i, 1));
      G[j][1].pb(mp(i, 0));
    }
    if(_tm(d[i]+d[j]) < a){
      G[i][0].pb(mp(j, 0));
      G[i][1].pb(mp(j, 1));
      G[j][0].pb(mp(i, 0));
      G[j][1].pb(mp(i, 1));
    }
  }
  queue<pii> q;
  FOR(i, 0, n){
    if(z[i][0]) continue;
    Fill(zz, false);
    q.push(mp(i, 0));
    z[i][0] = true;
    zz[i][0] = true;
    while(sz(q)){
      pii t = q.front();
      q.pop();
      each(itr, G[t.fi][t.se]){
        if(zz[itr->fi][1-itr->se]) return false;
        if(zz[itr->fi][itr->se]) continue;
        q.push(*itr);
        z[itr->fi][itr->se] = true;
        zz[itr->fi][itr->se] = true;
      }
    }
  }
  return true;
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  int minv = iinf;
  FOR(i, 0, n){
    cin >> d[i];
    mins(minv, d[i]);
  }
  int l = 0, r = minv+1, mid;
  while(r - l > 1){
    mid = (l+r)/2;
    if(check(mid)){
      l = mid;
    }else{
      r = mid;
    }
  }
  cout << l << endl;
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------


int main(){
ll a;
cin>>a;
cout<<48-a<<endl;
}









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

void fnInput(vector<vector<int>>& rvvnEnjoy)
{
  int nEnjoySiz;
  cin >> nEnjoySiz;
  rvvnEnjoy.resize(nEnjoySiz, vector<int>(3));

  for (int i = 0; i < nEnjoySiz; i++)
    cin >> rvvnEnjoy[i][0] >> rvvnEnjoy[i][1] >> rvvnEnjoy[i][2];
}
  
int fnDPHappy(const vector<vector<int>>& cnrvvnEnjoy)
{
  vector<vector<int>> vvnDPHappy(cnrvvnEnjoy.size() + 1, vector<int>(cnrvvnEnjoy[0].size()));

  for (int i = 0; i < cnrvvnEnjoy.size(); i++)
    for (int j = 0; j < cnrvvnEnjoy[i].size(); j++)
      for (int k = 0; k < cnrvvnEnjoy[i].size(); k++)
        if (j != k)
          vvnDPHappy[i + 1][j] = max(vvnDPHappy[i + 1][j], vvnDPHappy[i][k] + cnrvvnEnjoy[i][j]);

  int nMaxHappy = 0;
  int nLastDay = vvnDPHappy.size() - 1;

  for (int j = 0; j < vvnDPHappy[nLastDay].size(); j++)
    nMaxHappy = max(nMaxHappy, vvnDPHappy[nLastDay][j]);

  return nMaxHappy;
}
  
int main()
{
  vector<vector<int>> vvnEnjoy;
  fnInput(vvnEnjoy);
  cout << fnDPHappy(vvnEnjoy) << endl;

  return 0;
}

Measured memory_bytes: 11136
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
using namespace std;

int main(){
    int A,B,coin=0,M,m;
    cin>>A>>B;
    M=max(A,B);
    m=min(A,B);
    coin+=M;
    M-=1;
    coin+=max(M,m);
    cout<<coin<<endl;
    return 0;

}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int a, b, c;
	int tmp;

	scanf("%d%d%d", &a, &b, &c);
	if (a > b) tmp = a, a = b, b = tmp;
	if (b > c) {
		tmp = b, b = c, c = tmp;
		if (a > b) tmp = a, a = b, b = tmp;
	}
	printf("%d %d %d\n", a, b, c);
	return 0;
}



Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,D;
  cin >>A>>B>>C>>D;
  if((A+B) > (C+D))
    cout << "Left" << endl;
  else if((A+B) < (C+D))
    cout << "Right" << endl;
  else
    cout << "Balanced" <<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(){
	int n,i;
	char s[1001];
	char *p;
	scanf("%d",&n);while(getchar()!='\n');
	for(i=0;i<n;i++){
		gets(s);
		do{
			p=strstr(s,"Hoshino");
			if(p!=NULL)*(p+6)='a';
		}while(p!=NULL);
		puts(s);
	}
	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#define tt this->
#define ll long long
using namespace std;
int main ()
{
long long x,sum=0;
cin>>x;
for (int i=0;i<=x;i++)
{
    if (i%3!=0&&i%5!=0)
    sum=sum+i;
}
cout<<sum;
    return 0;
}

/*
▀█████████▄     ▄████████    ▄████████    ▄████████
  ███    ███   ███    ███   ███    ███   ███    ███
  ███    ███   ███    ███   ███    ███   ███    ███
 ▄███▄▄▄██▀    ███    ███  ▄███▄▄▄▄██▀   ███    ███
▀▀███▀▀▀██▄  ▀███████████ ▀▀███▀▀▀▀▀   ▀███████████
  ███    ██▄   ███    ███ ▀███████████   ███    ███
  ███    ███   ███    ███   ███    ███   ███    ███
▄█████████▀    ███    █▀    ███    ███   ███    █▀
                            ███    ███

*/


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
#define ST first
#define ND second
#define EB emplace_back
#define FOR(i, l, r) for(int i = (l); i <= (r); ++i)
#define REP(i, n) FOR(i, 0, (n) - 1)
template<class T> int size(T &&x) {
	return int(x.size());
}
#ifdef DEBUG
template<class A, class B> ostream& operator<<(ostream &out, const pair<A, B> &p) {
	return out << '(' << p.first << ", " << p.second << ')';
}
template<class T> auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out) {
	out << '{';
	for(auto it = x.begin(); it != x.end(); ++it)
		out << *it << (it == --x.end() ? "" : ", ");
	return out << '}';
}
void dump() {}
template<class T, class... Args> void dump(T &&x, Args... args) {
	cerr << x << ";  ";
	dump(args...);
}
  const int seed = 1;
  struct Nl{~Nl(){cerr << '\n';}};
# define debug(x...) cerr << (#x != "" ? #x ":  " : ""), dump(x), Nl(), cerr
#else
  const int seed = chrono::system_clock::now().time_since_epoch().count();
# define debug(...) 0 && cerr
#endif
mt19937_64 rng(seed);
int rd(int l, int r) {
	return uniform_int_distribution<int>(l, r)(rng);
}

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

	int n, m;
	cin >> n >> m;
	LL ans = 0;

	vector<vector<LL>> dp(n + 1, vector<LL>(m + 1));
	dp[0][0] = 1;

	vector<int> s(n), t(m);
	REP(i, n) cin >> s[i];
	REP(i, m) cin >> t[i];

	LL mod = 1e9 + 7;
	REP(i, n + 1) REP(j, m + 1)
	{
		if(i != 0 && j != 0)
		{
			if(s[i - 1] == t[j - 1])
			{
				debug(i, j, dp[i - 1][j - 1] + 1);
				dp[i][j] = dp[i - 1][j - 1];
			}
		}

		if(j != 0) dp[i][j] += dp[i][j - 1];
		if(i != 0) dp[i][j] += dp[i - 1][j];
		if(i != 0 && j != 0) dp[i][j] -= dp[i - 1][j - 1];
		dp[i][j] = ((dp[i][j]) % mod + mod) % mod;
		debug(i, j, dp[i][j]);
	}

	cout << dp[n][m] << "\n";
}


Measured memory_bytes: 31744
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
using namespace std;

long long N;

int f(long long a, long long b){
  return max(int(to_string(a).length()), int(to_string(b).length()));
}

int main(){
  ios_base::sync_with_stdio(false); 
  cin >> N;
  for(long long i=sqrt(N)+2; i>=1; --i){
      if(N%i == 0){
        cout << f(i, N/i) << "\n";
        return 0;
      }
  }
  return 0;
}


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

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

#define MOD 1000000007
//#define MOD 998244353

uint add(uint a, uint b) { return a+b < MOD ? a+b : a+b-MOD; }
uint sub(uint a, uint b) { return a < b ? a+MOD-b : a-b; }
uint mul(uint a, uint b) { return (ull)a*b%MOD; }
uint sqr(uint a) { return mul(a, a); }

uint modpow(uint b, uint e)
{
    uint r = 1;
    for (; e; e >>= 1) {
        if (e&1) r = mul(r, b);
        b = mul(b, b);
    }
    return r;
}

uint modinv(uint n) { return modpow(n, MOD-2); }
uint moddiv(uint n, uint d) { return mul(n, modinv(d)); }

#define MX 200016

uint fac[MX];

uint tri(uint x) { return mul(mul(x, x+1), (MOD+1)/2); }
uint binom(uint n, uint k) { return moddiv(fac[n], mul(fac[k], fac[n-k])); }

int main()
{
    canhazfast();

    int n, m, k, nm;
    uint sdi = 0, sdj = 0, ans = 0;

    cin >> n >> m >> k;
    nm = n*m;
    fac[0] = fac[1] = 1;
    for (int i = 2; i <= nm; ++i) fac[i] = mul(fac[i-1], i);
    for (int di = 1; di < n; ++di) {
        uint w = mul(sqr(m), mul(n-di, di));
        sdi = add(sdi, w);
    }
    //cerr << "sdi = " << sdi << '\n';
    for (int dj = 1; dj < m; ++dj) {
        uint w = mul(sqr(n), mul(m-dj, dj));
        sdj = add(sdj, w);
    }
    //cerr << "sdj = " << sdj << '\n';
    ans = add(sdi, sdj);
    ans = mul(ans, binom(nm-2, k-2));
    cout << ans << '\n';

    return 0;
}


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

int main(int argc, char const *argv[])
{
	char a,b;
	cin >> a >> b;
	if(a < b)	cout << "<" << endl;
	else if(a > b)	cout << ">" << endl;
	else cout << "=" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,s,n) for (int i = s; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pq = priority_queue<ll, vector<ll>, greater<ll>>;

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

ll dp[3010][3010][4];

int main() {
  int r,c,K;
  cin >> r >> c >> K;
  vector<vector<ll>> field(r+1,vector<ll>(c+1,0));
  rep(i,0,K) {
    int ri,ci; ll v;
    cin >> ri >> ci >> v;
    field[ri][ci] = v;
  }
  rep(i,1,r+1) rep(j,1,c+1) rep(k,0,4) {
    if (k > 0) {
      chmax(dp[i][j][k],dp[i][j-1][k-1] + field[i][j]);
    }
    chmax(dp[i][j][k],dp[i][j-1][k]);
    chmax(dp[i][j][1],dp[i-1][j][k] + field[i][j]);
  }
  ll ans = 0;
  rep(k,0,4) {
    chmax(ans,dp[r][c][k]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 355432
import java.io.*;
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
	
		MyScanner sc = new MyScanner();
		String s=sc.next();
		int l=s.length();
		int st=l-1;
		int en=0;
		for(int i=0;i<l;i++) {
			if(s.charAt(i)=='A') {
				st=Math.min(i,st);
			}
			if(s.charAt(i)=='Z') {
				en=Math.max(i,en);
			}
		}
		
        System.out.println(en-st+1);
		
	}
	
	
	
	
//----------------------------------------------------------
	static int l_min(int[] a) {
		Arrays.sort(a);
		return a[0];
	}
	static int l_max(int[] a) {
		int l=a.length;
		Arrays.sort(a);
		return a[l-1];
	}
	public static PrintWriter out;

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

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

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

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

	}
	

}





Measured memory_bytes: 27348
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>
#pragma warning(disable : 4996)
using namespace std;
long long n;
int main() {
	cin >> n;
	if (n % 11 == 0) cout << n / 11 * 2 << endl;
	else if (n % 11 <= 6) cout << n / 11 * 2 + 1 << endl;
	else cout << n / 11 * 2 + 2 << endl;
	return 0;
}

Measured memory_bytes: 256
# include <cstring>
# include <cstdio>
# include <iostream>
# include <queue>
# define N 100050 //N为顶点个数 
# define M 200050 //N为顶点个数 
# define WQD 0x7f7f7f7f//无穷大 
int n;//图的顶点个数
int m;//图的边数 
struct Edge{int next,to, w;}  e[M<<1];//不用0号单元 
int head[N+1]; 
int dis[N+1];//存放源点到其他点的路径
bool vis[N+1];
bool book[N+1];
bool spfa(int s);//差分约束判断 
using namespace std;
int main()
{
	ios::sync_with_stdio ( false ) ;
	int u,v,w;
	memset(head,-1,sizeof(head));
	cin>>n>>m;
	for(int i=1; i<=m; i++)  //本题约束关系为=，要添加两条边 
	{
		cin>>u>>v>>w;//输入第i条边 ,i为编号 
		e[i]=(Edge){head[u],v,w};head[u]=i;
		e[m+i]=(Edge){head[v],u,-w};head[v]=m+i;
	}
	memset(book,0,sizeof(book));
	memset(dis,0x7f,sizeof(dis));
	for(int i=1; i<=n; i++)//每一片的连通区域都要判断 
		if(!vis[i]) 
		{
			vis[i]=1;
			if(spfa(i)==false)  {cout<<"No";return 0;}//有约束自相矛盾 
		}
	cout<<"Yes";//所以的点都符合条件 
	return 0;
}
bool spfa(int s)
{
 	queue<int>q;
 	//memset(book,0,sizeof(book));
	//memset(dis,0x7f,sizeof(dis));
	dis[s]=0;
	q.push(s);book[s]=1;	
	//如果没松弛就松弛，如果松弛过就判断是否符合约束条件，如果自相矛盾就是不可能的数据
	while(q.size()>0) 
	{
		int k=q.front();q.pop();//对头元素出队 
		book[k]=0;
		for(int i=head[k]; i!=-1; i=e[i].next)
		{
			int v=e[i].to;
			if(dis[v]==WQD && dis[k]<WQD)//如果v点没松弛过，就松弛更新dis[v]的值 				
			{	//题目的约束条件是= 			
				dis[v]=dis[k]+e[i].w;//更新 
				if(book[v]==0)	{q.push(v);	book[v]=1;}//入队标记
				vis[v]=1;//标记该点已经松弛过 
			}
			//据题意理解差分系统约束条件，不相等，自相矛盾 
			else if(dis[v]<WQD && dis[k]<WQD && dis[v]!=dis[k]+e[i].w)	return false;
		}		
    }
	return true;//别掉了这句 
}

Measured memory_bytes: 6400
#include <cstdio>


int dp[35];


int main(){
    int n;
    while(scanf("%d",&n)&&n>0){
        for(int i=0;i<=34;i++) dp[i]=0;
        dp[0]=1;
        for(int cur=0;cur<=n;cur++){
            for(int step=1;step<=3;step++) dp[cur+step]+=dp[cur];
        }



        printf("%d\n",(dp[n]/3650)+(dp[n]%3659?1:0));
    }


    return 0;
}


Measured memory_bytes: 2572
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[N][N];
int color[N], d[N], f[N], tt;

void dfs_visit(int u) { //再帰によるDFS
	int v;
	color[u] = GRAY;
	d[u] = ++tt;

	for (v = 0; v < n; v++) {
		if (M[u][v] == 0)continue;
		if (color[v] == WHITE) {
			dfs_visit(v);
		}
	}
	color[u] = BLACK;
	f[u] = ++tt; //訪問完了
}

void dfs() {
	int u;
	for (u = 0; u < n; u++)color[u] = WHITE;
	tt = 0;
	for (u = 0; u < n; u++) {
		if (color[u] == WHITE)dfs_visit(u);
	}

	for (u = 0; u < n; u++) {
		printf("%d %d %d\n", u + 1, d[u], f[u]);
	}
}

int main() {
	int u, v, k, i, j;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++)M[i][j] = 0;
	}

	for (i = 0; i < n; i++) {
		scanf("%d %d", &u, &k);
		u--;
		for (j = 0; j < k; j++) {
			scanf("%d", &v);
			v--;
			M[u][v] = 1;
		}
	}

	dfs();

	return 0;
}


Measured memory_bytes: 2768
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val s = read().toList().sorted().distinct()

    var ch = 'a'
    var ans = "None"
    var i = 0
    while(ch <= 'z') {
        if(s.size <= i || ch != s[i]) {
            ans = ch.toString()
            break
        }
        ch++
        i++
    }
    println(ans)

    pw.flush()
}

/****** Decrared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun Float.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }

fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
        }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j] % MOD)
        }
    }
    return v.map { it.toList() }.toList()
}

// should be a >= b
fun gcd(a: Long, b: Long): Long = 
    if(b == 0L) a else gcd(b, a % b)

// shoud be a >= b
fun lcm(a: Long, b: Long): Long = 
    a / gcd(a, b) * b

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun isDecimal(v: Double): Boolean = ((v - Math.floor(v)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


Measured memory_bytes: 42012